#C6193. Order Status Tracker

    ID: 49926 Type: Default 1000ms 256MiB

Order Status Tracker

Order Status Tracker

You are given a log of order status updates. The first line contains an integer \(T\) representing the number of log entries. Each of the next \(T\) lines contains a log entry in the format "\(id\) \(status\)", where \(id\) is a positive integer and \(status\) is a string without spaces. For each order, determine its final status (i.e. the status from its last occurrence in the log), and output these statuses in the order in which the orders first appear in the log. All statuses should be printed on a single line, separated by a space.

inputFormat

The input is read from stdin as follows:

  • The first line contains an integer \(T\) (the number of log entries).
  • The following \(T\) lines each contain a log entry in the format "\(id\) \(status\)".

outputFormat

The output is written to stdout as a single line containing the final status for each distinct order (in the order of their first appearance), separated by spaces.

## sample
5
1 placed
1 processed
2 placed
2 processed
1 shipped
shipped processed