#C9318. Sort Treasure Batches

    ID: 53398 Type: Default 1000ms 256MiB

Sort Treasure Batches

Sort Treasure Batches

You are given a list of treasure batches. Each batch is represented by three integers which denote the number of gold, silver, and bronze coins respectively.

Your task is to sort these treasure batches lexicographically in ascending order. In other words, given two batches \((g_1, s_1, b_1)\) and \((g_2, s_2, b_2)\), the batch \((g_1, s_1, b_1)\) should come before \((g_2, s_2, b_2)\) if and only if one of the following holds:

  1. \(g_1 < g_2\), or
  2. \(g_1 = g_2\) and \(s_1 < s_2\), or
  3. \(g_1 = g_2\), \(s_1 = s_2\) and \(b_1 < b_2\).

After sorting the batches based on the criteria above, print each batch on a new line with the three numbers separated by a space.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains a single integer \(n\), the number of batches.
  2. The next \(n\) lines each contain three integers representing the number of gold, silver, and bronze coins in that batch.

outputFormat

Output the sorted list of batches to standard output (stdout). Each line should contain three integers separated by a space representing the coin counts of a batch.

## sample
3
2 5 1
1 2 3
2 2 3
1 2 3

2 2 3 2 5 1

</p>