This is an interactive problem.
There are people numbered through . Person can give a stick of Pepero to person if . We always have .
On each turn, choose a person who has not given a stick yet. The interactor selects an eligible person who has not received a stick yet. You fail if no such person exists. A person may give to themselves.
Make every person give exactly once and receive exactly once. The interactor may adapt its choices to previous turns; your strategy must succeed for every valid choice. A strategy that always succeeds exists.
Initially, the interactor sends the following data.
Perform exactly turns. On each turn, choose a person not chosen before, print the following line, and flush the output.
?
The interactor responds with an integer on one line: , and has not received a stick before. If no recipient is available, it sends ; terminate your program immediately in that case.
-1After successful turns, print the following line, flush, and terminate.
!
A repeated giver, an out-of-range index, malformed output, premature termination, or more than queries results in Wrong Answer. Failing to flush before waiting for a response may result in Time Limit Exceeded.