Rock paper scissors is a game in which two players each throw scissors, rock, or paper at the same time. Scissors beat paper, rock beats scissors, and paper beats rock. Matching throws are a tie.
Scissors is 0, rock is 1, and paper is 2.
You already played N rounds against the opponent. Choose the next throw by this rule.
Earlier wins, losses, and your own past throws do not change the next throw.
The first line contains N. (0≤N≤10000)
Each of the next N lines contains two integers, your throw and the opponent's throw, separated by a space. Each value is 0, 1, or 2.
If N=0, there are no further lines.
Print the next throw on one line. Scissors is 0, rock is 1, and paper is 2.
N=0 is the start of the match, so there is no prior result. Print 0 in that case. Otherwise only the opponent's last throw matters.