$Xq$ of Rainbow Island has recently become obsessed with a game called Old Man Ring, in which there is a golden tree with $n$ nodes numbered $1-n$, and node 1 is the root node. Now $Xq$ and his roommate climb the golden tree in black. They start from the two nodes of the golden tree at the same time, at the same speed, moving one node at a time, and walking in opposite directions along the path between the two nodes.When they reach the same node or neighboring node, $Xq$ wants to know where they end up.There are a total of $q$ queries. Each query gives the node $x$ and $y$ where the two men are located. For each query, the last node number of the two men is output respectively.