Sirko collected many bones, and as winter was approaching, he began stacking them in piles. Each pile contains at most bones, and the total number of piles is no more than .
"I'm tired of these arguments about binary or ternary logic," thought Smugastyk. "After all, ternary logic can still be reduced to binary," decided the clever cat and immediately thought up a new game. He numbered all the piles in a row and suggested to Sirko to play this game. Players move alternately, but Smugastyk always goes first. On each turn, a player first selects a pile numbered , then , according to these rules:
The pile numbered must not be empty.
The number must be strictly less than .
The pile numbered must also not be empty.
The sum A + B must not be divisible by , but must be divisible by (regarding binary and ternary logic... :) ).
From pile , an arbitrary, but nonzero, number of bones must be taken.
Whoever cannot make a move loses.
Who wins in this game if both players follow optimal strategies?
The first line contains the number of games played between Smugastyk and Sirko in a day: (1 \leq T \leq 100). The following lines each describe a game: first the number of piles , then numbers, each determining the number of bones in the corresponding pile.
Print a single line consisting of a sequence of digits: if Smugastyk wins, if Sirko wins.
Example 1