Let's define a tuple of length as an ordered collection of natural numbers (x_1, x_2, x_3, \ldots, x_M). The order of numbers in a tuple is fixed, meaning you cannot rearrange them. You will be given a set of tuples, each of the same length. Your task is to sort these tuples in non-decreasing order.
To solve this problem, use the following rule to compare tuples. A tuple (x_1, x_2, x_3, \ldots, x_M) is strictly less than tuple (y_1, y_2, y_3, \ldots, y_M) if there exists an index such that for all indices 1 \leq i < K, x_i = y_i, and at index , x_K < y_K. In other words, the first K-1 elements of the tuples are the same, but the -th element of the first tuple is less than in the second.
For example, the tuple (3, 5, 6, 7, 6, 9) is strictly less than the tuple (3, 5, 6, 9, 1, 1), because the first three elements in these tuples are the same, and the fourth element of the first tuple is less than in the second.
The tuples (4, 1, 2, 2, 1) and (4, 1, 2, 2, 1) are equal, while the tuple (5, 2, 3, 6, 8, 6, 7) is strictly greater than the tuple (5, 2, 1, 9, 3, 3, 7).
Here are more examples of tuple comparisons:
The first line of the input text file contains two natural numbers and separated by a space. is the number of tuples (1 \leq N \leq 1000000); is the number of elements in each tuple (1 \leq M \leq 10). The following lines each contain numbers separated by a space—these are the elements of the corresponding tuple. Each tuple element is an integer from to , inclusive.
Output all the tuples in non-decreasing order to the output text file. Print each tuple on a separate line. Separate the tuple's elements by a single space. The first line of the file should contain the first tuple in order, the last line—the last one.
Example 1