Bones for Sirko 2#1014

Bones for Sirko 2

10 seconds
64 megabytes
Hard

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:

Who wins in this game if both players follow optimal strategies?

Input

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.

Output

Print a single line consisting of a sequence of digits: if Smugastyk wins, if Sirko wins.

Examples

Example 1

Loading
Loading