Rock paper scissors
Time limit1sMemory limit256 MB
Read the past rounds and print 0 when there are none, 2 when the opponent last threw rock, and 0 otherwise.
- Level
Easy1 of 10
- Topics
- Implementation
- Solved
- No attempts yet
Problem
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 , rock is , and paper is .
You already played rounds against the opponent. Choose the next throw by this rule.
- If , throw .
- If , let be the opponent's throw in the last round. Throw when , and throw otherwise.
Earlier wins, losses, and your own past throws do not change the next throw.
Input
The first line contains . ()
Each of the next lines contains two integers, your throw and the opponent's throw, separated by a space. Each value is , , or .
If , there are no further lines.
Output
Print the next throw on one line. Scissors is , rock is , and paper is .
Hint
is the start of the match, so there is no prior result. Print in that case. Otherwise only the opponent's last throw matters.