Sorting Tuples
Write a program which reads n items and sorts them.
Each item has attributes {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.
first by value (ascending)
in case of a tie, by weight (ascending)
in case of a tie, by type (ascending in lexicographic order)
in case of a tie, by date (ascending)
in case of a tie, by name (ascending in lexicographic order)
The input is given in the following format.
n
v0 w0 t0 d0 s0
v1 w1 t1 d1 s1
:
vn−1 wn−1 tn−1 dn−1 sn−1
In the first line, the number of items n.
In the following n lines, attributes of each item are given.
viwitidisi represent value, weight, type, date and name of the i-th item respectively.
Print attributes of each item in order.
Print an item in a line and adjacency attributes should be separated by a single space.
1≤n≤100,000
0≤vi≤1,000,000,000
0≤wi≤1,000,000,000
ti is a upper-case
letter
0≤di≤2,000,000,000,000
1≤ size of si≤20
si≠sj if (i≠j)