Problem list
Log in
#r03310 · Online Judge > GoldOJ

Sort Coordinates

Silver V 2.0 s 256 MB

Given $N$ points in the plane, sort them by increasing $x$; ties broken by increasing $y$. Print the sorted points.

Input

First line $N$; then $N$ lines each with $x_i$ and $y_i$ ($-100000 \le x_i, y_i \le 100000$). All positions are distinct.

Output

Print each point x y on its own line, in sorted order.

Example 1

Input
5
3 4
1 1
1 -1
2 2
3 3
Output
1 -1
1 1
2 2
3 3
3 4
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code