Amy and Bob are good friends. Today they want to play a game.
Here is the process about it:
- There are n items in total. The ith item has ai points to Amy and bi points to Bob.
- Bob takes m items out of the game, so neither of them can pick these items. (0≤m≤n−2)
- Amy picks one item first, assume she takes jth item, then she gets aj points.
- Bob picks one item, assume he takes kthitem, then he gets bk points.k≠j
- The game ends.
Now they are wondering what is the value of aj−bk if they play optimally.
(Amy wants aj−bk to be maximum, Bob wants aj−bk to be minimum)
Please help them calculate the value when m is in [0,n−2].
Input
The first line contains one integer,
n (1≤n≤3×105) ---
the number of items.
Each of the next n lines contains two integers,
ai and bi(1≤ai,bi≤109)---
meaning the ithitem has ai value to Amy and bi value to Bob.
Output
Output n−1integers, each of them in one line.
The ithline is the value of aj−bk when Bob bans exactly i−1 items
(1≤i≤n−1)
Sample Input 1
5 2 2 3 2 4 4 5 6 6 6
Sample Output 1
0 0 0 0
Sample Input 2
3 4 100 5 98 1 100
Sample Output 2
-95 -96