#D1757. Sorting Pairs

    ID: 1463 Type: Default 1000ms 268MiB

Sorting Pairs

Sorting Pairs

Write a program which print coordinates (xi,yi)(x_i, y_i) of given nn points on the plane by the following criteria.

  1. first by xx-coordinate
  2. in case of a tie, by yy-coordinate

Constraints

  • 1n100,0001 \leq n \leq 100,000
  • 1,000,000,000xi,yi1,000,000,000-1,000,000,000 \leq x_i, y_i \leq 1,000,000,000

Input

The input is given in the following format.

nn x0  y0x_0 \; y_0 x1  y1x_1 \; y_1 : xn1  yn1x_{n-1} \; y_{n-1}

In the first line, the number of points nn is given. In the following nn lines, coordinates of each point are given.

Output

Print coordinate of given points in order.

Example

Input

5 4 7 5 5 2 3 6 8 2 1

Output

2 1 2 3 4 7 5 5 6 8

inputFormat

Input

The input is given in the following format.

nn x0  y0x_0 \; y_0 x1  y1x_1 \; y_1 : xn1  yn1x_{n-1} \; y_{n-1}

In the first line, the number of points nn is given. In the following nn lines, coordinates of each point are given.

outputFormat

Output

Print coordinate of given points in order.

Example

Input

5 4 7 5 5 2 3 6 8 2 1

Output

2 1 2 3 4 7 5 5 6 8

样例

5
4 7
5 5
2 3
6 8
2 1
2 1

2 3 4 7 5 5 6 8

</p>