- Time limit: 1.00 s
- Memory limit: 512 MB
You have coins, each of which has a distinct weight.
There are two stacks which are initially empty. On each step you move one coin to a stack. You never remove a coin from a stack.
After each move, your task is to determine which stack is heavier (if we can be sure that either stack is heavier).
Input
The first input line has an integer : the number of coins. The coins are numbered . You know that coin is always heavier than coin , but you don't know their exact weights.
After this, there are lines that describe the moves. Each line has two integers and : move coin to stack (1 = left, 2 = right).
Output
After each move, print <
if the right stack is heavier, >
if the left stack is heavier, and ?
if we can't know which stack is heavier.
Constraints
Example
Input:
3 2 1 3 2 1 1
Output:
> < ?
Explanation: After the last move, if the coins are , the left stack is heavier, but if the coins are , the right stack is heavier.