#K61092. Employee Database Command Processor

    ID: 31232 Type: Default 1000ms 256MiB

Employee Database Command Processor

Employee Database Command Processor

You are given a series of commands to manage an employee database. Each command can be one of the following:

  • INSERT id name salary: Insert a new employee with the given id, name, and salary. If an employee with the same id already exists, update their record with the new name and salary.
  • DELETE id: Delete the employee with the given id from the database. If no such employee exists, do nothing.
  • QUERY id: Query the employee with the given id. If found, output the employee’s name and salary separated by a space; otherwise, output "NOT FOUND".

The commands are processed in the order they appear. Formally, let \(D\) be the database and each command modifies or queries \(D\) accordingly. For the query commands, output the result on a new line.

Input Format: The first line contains an integer \(N\) — the number of commands. The following \(N\) lines each contain a command as described above.

inputFormat

The first line of input contains an integer \(N\) denoting the number of commands. Each of the next \(N\) lines contains one of the commands described above. Commands are space separated tokens.

outputFormat

For each QUERY command in the order they appear, print the result on a new line. The output for a query is either "name salary" (if found) or "NOT FOUND".

## sample
7
INSERT 1 John 50000
INSERT 2 Alice 60000
QUERY 1
QUERY 3
INSERT 1 Michael 70000
QUERY 1
DELETE 2
John 50000

NOT FOUND Michael 70000

</p>