eolymp
bolt
Try our new interface for solving problems
Problems

Only three handfuls!

Only three handfuls!

There are three handfuls of pebbles. Vassya and Peter play a game, making moves in turns, and Peter always goes first. In one move, it is allowed to take any number of stones from one handful or same number from two handfuls . The winner is the one who will take the last stone. To determine which of them will win, if both during the game kept to the optimal strategy. \InputFile The first line specifies the number of test cases \textbf{T} (\textbf{1} ≤ \textbf{T} ≤ \textbf{20}), and the subsequent \textbf{T} line set through the gap to \textbf{3} numbers - the number of pebbles in a handful of \textbf{A}, \textbf{B}, \textbf{C}. (\textbf{0} ≤ \textbf{A}, \textbf{B}, \textbf{C} ≤ \textbf{301} and \textbf{A} + \textbf{B} + \textbf{C} > \textbf{0}). \OutputFile For each test case output one line \textbf{1} -- if Peter wins, or \textbf{2} -- if Vassya wins.
Time limit 3 seconds
Memory limit 64 MiB
Input example #1
3
1 0 0
1 1 1
2 3 6
Output example #1
122
Source Stage III All-Ukrainian Olympiad 2009-2010 Zhitomir