CPython lite logoProblemsContests

51. Sorting #3

There are n points given in the coordinate plane. First, sort these points by the x coordinate. If the x coordinates are equal, sort by the y coordinate.


Input

The first line contains a natural number n that does not exceed 1000.

The next n lines contain the coordinates of the points, x and y. Their values do not exceed 1000.

Output

The points sorted in n lines.


Sample input 1

5 
4 1
1 6
2 3
1 4 
2 4

Sample output 1

1 4
1 6
2 3
2 4
4 1

Login to be able to submit.

NormalData structures
119 / 15
Solved / unsolved count
1.0 s / 512 MB
Limits