Problem: This is an interactive problem.
Little Dormi was faced with an awkward problem at the carnival: he has to guess the edges of an unweighted tree of nodes! The nodes of the tree are numbered from to .
The game master only allows him to ask one type of question:
- Little Dormi picks a node (), and the game master will reply with an array , where is the length of the shortest path from node to , for all .
Additionally, to make the game unfair challenge Little Dormi the game master will allow at most questions, where denotes the smallest integer greater than or equal to .
Faced with the stomach-churning possibility of not being able to guess the tree, Little Dormi needs your help to devise a winning strategy!
Note that the game master creates the tree before the game starts, and does not change it during the game.
Input Format: The first line of input contains the integer (), the number of nodes in the tree.
You will then begin interaction.
Output Format: When your program has found the tree, first output a line consisting of a single "!" followed by lines each with two space separated integers and , denoting an edge connecting nodes and (). Once you are done, terminate your program normally immediately after flushing the output stream.
You may output the edges in any order and an edge is considered the same as an edge . Answering is not considered as a query.
Note: Here is the tree from the first example.
Notice that the edges can be output in any order.
Additionally, here are the answers for querying every single node in example :
- :
- :
- :
- :
Below is the tree from the second example interaction.
Lastly, here are the answers for querying every single node in example :
- :
- :
- :
- :
- :