Problem list
Log in
#r03312 · Online Judge > GoldOJ

Sort Coordinates 3

Silver V 2.0 s 256 MB

Given $N$ points in 3D space, sort them by increasing $z$; ties broken by decreasing $y$; further ties by increasing $x$. Print the sorted points.

Input

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

Output

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

Example 1

Input
5
1 1 1
3 4 1
1 -1 1
2 2 2
3 3 1
Output
3 4 1
3 3 1
1 1 1
1 -1 1
2 2 2
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