Computer Games
Maristel and Cong are processing all the forms, permits, and paperwork needed to run RMIT MATRIX. Oh yes, there's mountains of it. I totally didn't make this up just for the sake of a programming exercise.
To split up the work and make it a little bit more interesting, they play a game, where the loser has to work on one of the documents. The rules are as follows:
- This game takes place on a \(3 \times 2\) grid; the grid's horizontal length is \(3\) cells, and its vertical length is \(2\) cells
- Each player has a symbol assigned to themselves
- This game is played in turns; on each turn, the person whose turn it is may place their symbol on the board
- If anyone places their symbols in a vertical line of \(2\) symbols or a horizontal line of \(3\) symbols, they win

But, there's so much work to do that playing this game takes too long for Maristel. So, as all super-trendy, extra-hireable engineers do, she outsources the task to a chatbot.
"Play this game for me," she instructs the chatbot. "Make no mistakes".
With these three powerful words, the chatbot is magically transformed from a mere token prediction engine into an omnipotent, all-knowing oracle incapable of ever making a mistake. Besides possibly posing a threat to humanity, this oracle demonstrates some interesting properties:
- If the game begins on Cong's turn, the oracle will sometimes lose to Cong, despite playing perfectly
- If the game begins on the oracle's turn, Cong will always lose to the Oracle every single time
This suggests that this game features a perfect strategy for the player that plays their turn first. Can you replicate the oracle's strategy?
Input and Output
This exercise is interactive. Your program will not be given all inputs at the start; it must produce outputs in order to yield inputs.
In this case, all inputs and outputs conform to the same format. Each input or output consists of a single line containing two integers, \(1 \leq x_i \leq 3\) and \(1 \leq y_i \leq 2\). \(x_i\) is the horizontal position of a symbol being placed this turn, whereas \(y_i\) is the vertical position of a symbol being placed this turn.
Your program must first produce such an output, representing where it will place its symbol. Then, it will be given such an input, representing where the opponent placed their symbol. This continues repeatedly until one player wins the game.
Your program can place its symbols anywhere it wants. All that matters is that the program always wins, no matter what move the opponent makes.
The opponent will never (and the program must never) place a symbol in a position where there is already a symbol.
Example 1
Output:
2 1
The program begins by placing its symbol at \((2, 1)\).
This is just an example of a valid sequence. Your program can place its symbols anywhere it wants; it just has to always win, and play according to the rules.
Input:
3 2
The opponent responds by placing its symbol at \((3, 2)\).
Of course, this is just one possible response. The program must be capable of winning no matter what move the opponent makes.
Output:
2 2
At this point, the program has won the game. It must not await an additional input.
Example 2
Output:
3 2
Input:
3 1
Output:
2 2
Input:
1 1
Output:
2 1
At this point, the program has won the game. It must not await an additional input.
Comments