J. Permutation Reconstruction
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

There is a hidden permutation $$$P$$$ of $$$\{1, 2, \ldots n\}$$$. In one query, you can output a permutation $$$Q$$$ of $$$\{1, 2, \ldots n\}$$$ and in return get the value:

$$$$$$ \sum_{i=1}^{n} |P_i - Q_i| $$$$$$

You can ask at most $$$1300$$$ queries. Recover the permutation $$$P$$$.

Interaction

First, read an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$). Then, you can output a permutation $$$Q$$$ of $$$\{1, 2, \ldots n\}$$$ at most $$$1301$$$ times (It is $$$1301$$$ instead of $$$1300$$$ because the last query is not counted, as you will see later). The judge returns its sum of absolute differences when compared with $$$P$$$.

The judge returns with an ok verdict when $$$Q = P$$$ (or equivalently, the return value is $$$0$$$). Else, if $$$Q$$$ is never equal to $$$P$$$, you get a wrong answer verdict.

Example
Input
4

4

6

0

Output

1 2 3 4

2 3 4 1

2 3 1 4
Note
  • The grader is not adaptive, which means that the permutation $$$P$$$ is fixed before the interaction begins.
  • After printing a query do not forget to output the end of line and flush the output.
  • Once you get a response $$$0$$$ from the judge, the judge exits with an accepted verdict, and hence you should also exit your program.