#K86892. File Versioning System

    ID: 36965 Type: Default 1000ms 256MiB

File Versioning System

File Versioning System

You are given a set of operations to simulate a file versioning system. The system supports three commands:

  • CREATE file_id version: Creates a new file with identifier file_id and assigns it a version.
  • MODIFY file_id new_version: Updates an existing file to the new version new_version. If the file does not exist, it is created with new_version.
  • RETRIEVE file_id: Retrieves the current version of the file with identifier file_id if it exists; otherwise, outputs \(\text{File does not exist}\).

Process the operations in the given order and output the result for every RETRIEVE command.

inputFormat

The first line of input contains an integer \(n\) \((1 \leq n \leq 10^5)\), the number of operations. Each of the following \(n\) lines contains one operation in one of the following formats:

  • CREATE file_id version
  • MODIFY file_id new_version
  • RETRIEVE file_id

outputFormat

For each RETRIEVE operation, print the current version of the file on a separate line. If the file does not exist, output File does not exist.

## sample
7
CREATE file1 v1
MODIFY file1 v2
RETRIEVE file1
CREATE file2 v1
RETRIEVE file2
MODIFY file1 v3
RETRIEVE file1
v2

v1 v3

</p>