#K221. Employee Task Completion Tracker

    ID: 24686 Type: Default 1000ms 256MiB

Employee Task Completion Tracker

Employee Task Completion Tracker

You are given a series of queries that simulate recording and updating task completion times for employees. Each query can be one of the following three types:

  • C id time: Record the completion time for a task with identifier id using the provided time.
  • U id time: Update the completion time for an existing task with identifier id to the new time.
  • Q id: Query the current recorded completion time for the task with identifier id.

For each query of type Q, output the corresponding completion time. All queries are processed sequentially, and you can assume that for a query Q id the task id has already been recorded by a previous C or U command.

The operations can be defined mathematically as follows: For a task id, let T(id) denote its stored completion time. Then:

\[ T(id) = \begin{cases} time, & \text{if the command is } C \text{ or } U,\\ \text{previous value of } T(id), & \text{if the command is } Q. \end{cases} \]

Implement the solution such that it reads from standard input and writes to standard output.

inputFormat

The first line contains an integer q representing the number of queries.

The next q lines each contain a query in one of the following formats:

  • C id time
  • U id time
  • Q id

Each query field is separated by a space.

outputFormat

For each query of type Q, output the recorded task completion time on a separate line.

## sample
3
C 1 5
C 2 3
Q 1
5

</p>