Mirko and Slavko are playing a new game. Again. Slavko starts each round by giving Mirko two numbers $A$ and $B$, both smaller than $100$. Mirko then has to solve the following task for Slavko: how to pair all given $A$ numbers with all given $B$ numbers so that the maximal sum of such pairs is as small as possible.
In other words, if during the rounds so far Slavko gave the numbers $a_1, a_2, a_3, \ldots, a_n$ and $b_1, b_2, b_3, \ldots, b_n$, determine $n$ pairings $(a_i, b_j)$ such that each number in the $A$ sequence is used in exactly one pairing, each number in the $B$ sequence is used in exactly one pairing, and the maximum of all sums $a_i + b_j$ is minimal.
Input
The first line of input contains a single integer $N$ ($1 \le N \le 100,000$), the number of rounds.
Each of the next $N$ lines contains two integers $A$ and $B$ ($1 \le A, B \le 100$), the numbers given by Slavko in that round.
Output
Output consists of $N$ lines, one for each round. Each line should contain the smallest maximal sum for that round (considering all numbers given up to and including that round).
Scoring: Test cases worth $50%$ of total points have $N \le 200$.
Example 1
3 2 8 3 1 1 4
10 10 9
Example 2
3 1 1 2 2 3 3
2 3 4
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.