Division Expression

Time Limit:1000ms Memory Limit:64000KiB
Accepted:0 Submitted:0
Division Expression

BOI 2000 Day 2 Problem 1

Division Expression

Division expression is an arithmetic expression of the form

x1/x2/x3/.../xk

where xi is a positive integer, for i, (1<=i<=k). Division expression is evaluated from the left to the right. For instance the value of the expression

1/2/1/2

is 1/4. One can put parentheses into expression in order to change its value. For example the value of the expression

(1/2)/(1/2)

is 1. We are given a division expression E. Is it possible to put some parentheses into E to get an expression E' whose value is an integer number.

Task

Write a program that for each data set from a sequence of several data sets:
  • reads an expression E from the text file DIV.IN,
  • verifies whether it is possible to put some parentheses in E to get a new expression E' whose value is an integer number,
  • writes the result to the text file DIV.OUT

Input

The first line of the file DIV.IN contains one positive integer d, (d<=5). This is the number of data sets. The data sets follow. The first line of each data set contain an integer n, (2<=n<=10000). This is the number of integers in the expression. Each of the following n lines contains exactly one positive integer not greater than 1,000,000,000. The ith number is the ith integer in the expression.

Output

For each i,(1<=i<=d) your program should write to the ith line of the output file DIV.OUT one word YES, if the ith input expression can be transformed into an expression whose value is an integer number, and the word NO in the other case.

Sample Input

2
4
1
2
1
2
3
1
2
3

Sample Output

YES
NO

Remark

Time limit for each test: 2 s
SubmitStatistics

SOJ is designed and developed by Wilbur Ding and Liang Sun. ©All Rights Reserved 2009-2012.