There are multiple test cases. The first line of input contains an integer, indicating the number of test cases. For each test case:
The first line contains an integer– the number of operations.
Each of the followinglines contains two integers
and
![]()
.
It is guaranteed that the sum ofof all test cases
will not exceed
.
For each test case, outputintegers where the
-th integer denotes the value of
after the
-th operation.