405018: GYM101741 H Compressed Spanning Subtrees
Description
This is an interactive problem. Make sure that your output does not get buffered after each query. Use, for instance, fflush(stdout) in C++, System.out.flush() in Java, or sys.stdout.flush() in Python.
For a tree T consisting of n vertices numbered from 1 to n, the compressed spanning subtree S(X) of a set X of spanned vertices (vertices that are not in X are called not spanned) can be defined by the following algorithm:
- Assign S(X) ≤ ftarrow T;
- If there is any not spanned vertex that has exactly one edge incident to it, remove it along with the edge;
- Repeat step 2 while its condition stays true;
- If there is any not spanned vertex that has exactly two edges incident to it, remove it along with the edges and add a new edge connecting the two remaining endpoints of the removed edges;
- Repeat step 4 while its condition stays true.
Formally, S(X) is the smallest subgraph of T containing all vertices in X and then having all other vertices of degree two or less smoothed out.
![](https://espresso.codeforces.com/72a7bd28d535bc747515ce84ae7efb209f761aa9.png)
You are not given the tree T. Instead, your task is to find it. You can ask questions of the following form: "How many vertices does the compressed spanning subtree of X contain?". And since otherwise finding the tree by asking such questions would be impossible, there are no vertices incident to exactly two edges in T.
InteractionThe first line of input contains a single integer n (2 ≤ n ≤ 100).
Your program can ask a question by printing a line in the format "? k x1 x2 ... xk" where integer k (1 ≤ k ≤ n) equals to the number of vertices in X and distinct integers xi (1 ≤ xi ≤ n) represent these vertices in any order. You can ask no more than 2550 questions.
The answer for such question is an integer given on a separate line: the number of vertices in the compressed spanning subtree in question.
After asking sufficient questions, your program must give the answer by printing a line in the format "! p2 p3 ... pn". Here, considering T as a rooted tree with root at vertex 1, pi must be the parent vertex of vertex i. After giving the answer, the program must immediately terminate gracefully.
ExampleInput6Output
3
4
4
? 3 4 3 6
? 4 1 2 3 6
? 3 2 5 6
! 1 2 2 3 3