Fibonacci Partition

아직 제출이 없습니다시간 제한10초메모리 제한256 MB

문제

The sequence of Fibonacci numbers is defined as: F_n={1n=1 2n=2 F_n1+F_n2otherwiseF\_n=\begin{cases} 1 & n=1 \\\ 2 & n=2 \\\ F\_{n-1}+F\_{n-2} & \text{otherwise} \end{cases}

The first few elements of the sequence are 1,2,3,5,8,13,21,34,1, 2, 3, 5, 8, 13, 21, 34, \dots

For a given positive integer nn, let partition(n)\mathit{partition}(n) be the maximum value of mm such that nn can be expressed as a sum of mm distinct Fibonacci numbers. For example, partition(1)=partition(2)=1\mathit{partition}(1) = \mathit{partition}(2) = 1, partition(3)=partition(4)=partition(5)=partition(7)=2\mathit{partition}(3) = \mathit{partition}(4) = \mathit{partition}(5) = \mathit{partition}(7) = 2, partition(6)=partition(8)=3\mathit{partition}(6) = \mathit{partition}(8) = 3.

Chiaki has an integer XX which initially equals to 00. She will perform some operations on XX: the ii-th operation will add a_iF_b_ia\_i \cdot F\_{b\_i} to XX

After each operation, Chiaki would like to know the value of partition(X)\mathit{partition}(X). It is guaranteed that, after each operation, XX will be a positive integer.

입력

There are multiple test cases. The first line of input contains an integer TT, indicating the number of test cases. For each test case:

The first line contains an integer nn (1n51041 \le n \le 5 \cdot 10^4): the number of operations.

Each of the next nn lines contains two integers a_ia\_i and b_ib\_i (1a_i,b_i1091 \le |a\_i|, b\_i \le 10^9).

It is guaranteed that the sum of nn for all test cases will not exceed 51045 \cdot 10^4.

출력

For each test case, output nn integers: the ii-th integer denotes the value of partition(X)\mathit{partition}(X) after the ii-th operation.

힌트

The value of XX after each operation in the sample: 1,2,4,7,12,20,33,54,88,721, 2, 4, 7, 12, 20, 33, 54, 88, 72.