This is an interactive problem.
The jury made a random undirected graph of n vertices and m edges with no loops or parallel edges. In each test, the graph is randomly uniformly sampled from all possible graphs with fixed n and m before the testing of your program starts.
Your program has to determine whether the graph is connected, while knowing only n and m at first. The program can perform a "? i" query (1≤i≤n) at most 2⋅n times. In response for such query, the testing system will give either:
? j" queries).Empty lines are added for clarity, they are absent during interaction.
In the example test, the two following graphs are used. The testing system responds to "? i" with the first edge in the list which is adjacent to i and was not yet communicated to the program.