LearnPy Hub
← Arena
AdvancedRating 1800

Rebuild the Queue

Each person is (h, k): height h and k people in front who are at least as tall. Rebuild the queue and print it as h,k pairs separated by spaces.

Input

n, then n lines 'h k'.

Output

One line.

Sample 1

Input
6
7 0
4 4
7 1
5 0
6 1
5 2
Output
5,0 7,0 5,2 6,1 4,4 7,1

Sample 2

Input
1
5 0
Output
5,0
solution.py
Output appears here
Rebuild the Queue · Python Arena problem · LearnPy Hub