Stacked Floating Mountains

No attempts yetTime limit1sMemory limit128 MB

Problem

The floating mountains of Pandora are a puzzle for the human scientists — especially the geologists and physicists — who are trying to understand how such structures could exist. While exploring the mountains, the scientists came across intriguing stacked floating mountain structures, in which different mountains were piled one above another, with the larger mountains sitting higher up in the stack. The scientists were able to measure the size of each mountain, and they made an interesting observation: the sizes of the mountains form a (generalized) Fibonacci sequence.

A sequence of numbers $x_1, x_2, \dots, x_n$ is called a generalized Fibonacci sequence if, for every $i > 2$,

$$x_i = x_{i-1} + x_{i-2}$$

The standard Fibonacci sequence is simply a generalized Fibonacci sequence with $x_1 = x_2 = 1$. Another example of a generalized Fibonacci sequence is $2, 5, 7, 12, 19, \dots$

Your goal is to help verify this observation. Specifically, write a program that, given a sequence of numbers, decides whether the sequence is a generalized Fibonacci sequence or not.

Input

The first line contains the number of test cases, $n$. Each of the following lines contains one test case. A test case begins with the number of elements in the sequence, $k$, followed by the $k$ numbers that make up the sequence. All numbers are at least $0$ and less than $2^{30}$.

Output

For each test case, output YES if the sequence is a generalized Fibonacci sequence, or NO if it is not, one answer per line.