#D2336. Sorting Tuples

    ID: 1945 Type: Default 1000ms 268MiB

Sorting Tuples

Sorting Tuples

Write a program which reads nn items and sorts them. Each item has attributes value,weight,type,date,name\\{value, weight, type, date, name\\} and they are represented by \\{ integer, integer, upper-case letter, integer, string \\} respectively. Sort the items based on the following priorities.

  1. first by value (ascending)
  2. in case of a tie, by weight (ascending)
  3. in case of a tie, by type (ascending in lexicographic order)
  4. in case of a tie, by date (ascending)
  5. in case of a tie, by name (ascending in lexicographic order)

Constraints

  • 1n100,0001 \leq n \leq 100,000
  • 0vi1,000,000,0000 \leq v_i \leq 1,000,000,000
  • 0wi1,000,000,0000 \leq w_i \leq 1,000,000,000
  • tit_i is a upper-case letter
  • 0di2,000,000,000,0000 \leq d_i \leq 2,000,000,000,000
  • 11 \leq size of si20s_i \leq 20
  • sisjs_i \ne s_j if (ij)(i \ne j)

Input

The input is given in the following format.

nn v0  w0  t0  d0  s0v_0 \; w_0 \; t_0 \; d_0 \; s_0 v1  w1  t1  d1  s1v_1 \; w_1 \; t_1 \; d_1 \; s_1 : $v_{n-1} \; w_{n-1} \; t_{n-1} \; d_{n-1} \; s_{n-1}$

In the first line, the number of items nn. In the following nn lines, attributes of each item are given. vi  wi  ti  di  siv_i \; w_i \; t_i \; d_i \; s_i represent value, weight, type, date and name of the ii-th item respectively.

Output

Print attributes of each item in order. Print an item in a line and adjacency attributes should be separated by a single space.

Example

Input

5 105 24 C 1500000000000 white 100 23 C 1500000000000 blue 105 23 A 1480000000000 pink 110 25 B 1500000000000 black 110 20 A 1300000000000 gree

Output

100 23 C 1500000000000 blue 105 23 A 1480000000000 pink 105 24 C 1500000000000 white 110 20 A 1300000000000 gree 110 25 B 1500000000000 black

inputFormat

Input

The input is given in the following format.

nn v0  w0  t0  d0  s0v_0 \; w_0 \; t_0 \; d_0 \; s_0 v1  w1  t1  d1  s1v_1 \; w_1 \; t_1 \; d_1 \; s_1 : $v_{n-1} \; w_{n-1} \; t_{n-1} \; d_{n-1} \; s_{n-1}$

In the first line, the number of items nn. In the following nn lines, attributes of each item are given. vi  wi  ti  di  siv_i \; w_i \; t_i \; d_i \; s_i represent value, weight, type, date and name of the ii-th item respectively.

outputFormat

Output

Print attributes of each item in order. Print an item in a line and adjacency attributes should be separated by a single space.

Example

Input

5 105 24 C 1500000000000 white 100 23 C 1500000000000 blue 105 23 A 1480000000000 pink 110 25 B 1500000000000 black 110 20 A 1300000000000 gree

Output

100 23 C 1500000000000 blue 105 23 A 1480000000000 pink 105 24 C 1500000000000 white 110 20 A 1300000000000 gree 110 25 B 1500000000000 black

样例

5
105 24 C 1500000000000 white
100 23 C 1500000000000 blue
105 23 A 1480000000000 pink
110 25 B 1500000000000 black
110 20 A 1300000000000 gree
100 23 C 1500000000000 blue

105 23 A 1480000000000 pink 105 24 C 1500000000000 white 110 20 A 1300000000000 gree 110 25 B 1500000000000 black

</p>