#P1531. Simulate Teacher's Query and Grade Update

    ID: 14817 Type: Default 1000ms 256MiB

Simulate Teacher's Query and Grade Update

Simulate Teacher's Query and Grade Update

This problem requires you to simulate the operations requested by a teacher. The teacher can either query a student's current grade or update a student's grade according to the commands provided. Initially, no student has a recorded grade.

You will be given a number of commands. There are two types of commands:

  • U student_name grade: Update (or add) the record for student_name with the new grade (an integer).
  • Q student_name: Query for the grade of student_name. If the student exists in the records, print the student name followed by a space and the grade. Otherwise, print student_name not found.

Process the commands in the order they are provided.

Example:

Input:
6
U Alice 90
Q Alice
Q Bob
U Bob 80
Q Bob
Q Alice

Output: Alice 90 Bob not found Bob 80 Alice 90

</p>

inputFormat

The first line contains an integer n (1 ≤ n ≤ 10^5) denoting the number of commands. Each of the following n lines contains a command in one of the two formats:

  1. U student_name grade
  2. Q student_name

Here, student_name is a string without spaces and grade is an integer.

outputFormat

For each query command (lines starting with Q), print a single line. If the student exists, output "student_name grade". Otherwise, output "student_name not found".

sample

6
U Alice 90
Q Alice
Q Bob
U Bob 80
Q Bob
Q Alice
Alice 90

Bob not found Bob 80 Alice 90

</p>