This is an interactive problem.
Dadas chooses a permutation containing each integer from to exactly once. The permutation is fixed before the interaction begins and is hidden from the contestant.
Your goal is to determine the permutation exactly by asking queries.
In a query, you provide a permutation containing each integer from to exactly once. The interactor defines a permutation by
and returns only the length of the longest cycle in the cycle decomposition of .
This is an interactive problem.
At the beginning of the interaction, the contestant program receives
The contestant program may ask at most queries of the ? form. To ask a query, print
must be a permutation containing each integer from to exactly once. The same permutation may be queried more than once. After printing a query, flush the output buffer.
After each valid query, the program receives an integer . It is the length of the longest cycle of the permutation defined by .
Once you have determined , print the final answer in the following format.
The final ! output does not count toward the limit of queries. If the final answer differs from the hidden permutation , the submission is incorrect. Flush the output buffer after printing the final answer and terminate the program immediately.
If you print an invalid query or ask more than queries of the ? form, you may receive -1. In that case, terminate the program immediately.
Example interaction
Consider and the hidden permutation . The actual interaction does not reveal .
3.? 1 2 3 and flushes. Here , so the interactor sends 3.? 3 1 2 and flushes. Here , so the interactor sends 1.! 2 3 1, flushes, and terminates.This example illustrates the communication format and the meaning of responses; it does not describe a general method for recovering the permutation.
? query, must be a permutation of .? form may be asked.