#C6887. Scroll Management in the Grand Library

    ID: 50696 Type: Default 1000ms 256MiB

Scroll Management in the Grand Library

Scroll Management in the Grand Library

You are given a collection of ancient scrolls in the Grand Library, each with an initial scholarly value. The library needs to update these values and answer queries about them. There are two types of operations:

  • update i v: Set the value of the ith scroll to v.
  • query i: Output the current value of the ith scroll.

All indices are 1-based. In mathematical terminology, for an update operation, if the initial value of the ith scroll is \( a_i \), then after an update operation update i v, the new value becomes \( a_i = v \). For each query operation, print the current \( a_i \) on a new line.

inputFormat

The input is given via standard input (stdin) with the following format:

  • The first line contains two integers \( n \) and \( m \) representing the number of scrolls and the number of operations respectively.
  • The second line contains \( n \) space-separated integers. These are the initial scholarly values of the scrolls.
  • The next \( m \) lines describe operations in one of the two forms:
    • update i v: update the \(ith\) scroll's value to \( v \).
    • query i: query the current value of the \(ith\) scroll.

outputFormat

For every query operation, output the current value of the scroll on a separate line to standard output (stdout).

## sample
5 3
10 20 30 40 50
update 3 35
query 3
query 5
35

50

</p>