#K56577. Prepare Order Sequence

    ID: 30229 Type: Default 1000ms 256MiB

Prepare Order Sequence

Prepare Order Sequence

You are given a list of orders, each order is represented by an integer order ID and a time in the (HH:MM) format. Your task is to sort the orders in ascending order first by their order ID and then by the order time. In other words, if two orders have the same ID, the one with the earlier time should come first.

For example, given the following orders:

  • 5 09:00
  • 3 09:30
  • 5 08:00
  • 4 09:15
  • 5 08:30
The sorted output should be:
  • 3 09:30
  • 4 09:15
  • 5 08:00
  • 5 08:30
  • 5 09:00

You need to write a program that reads the input from standard input (stdin) and writes the output to standard output (stdout).

inputFormat

The first line contains an integer (n) representing the number of orders. Each of the following (n) lines contains an integer and a time string in (HH:MM) format separated by a space, representing the order ID and the order time.

outputFormat

Output (n) lines. Each line contains the order ID and the time separated by a space, printed in the sorted order as described.## sample

5
5 09:00
3 09:30
5 08:00
4 09:15
5 08:30
3 09:30

4 09:15 5 08:00 5 08:30 5 09:00

</p>