#K62862. Taco Operations

    ID: 31626 Type: Default 1000ms 256MiB

Taco Operations

Taco Operations

You are given \(N\) products each having an initial availability status represented by a character. The status is provided as a string of length \(N\) where the character A indicates that a product is available and N indicates it is not available.

After the initial status, you will be given a sequence of operations to perform on these products. There are two types of operations:

  • Update Operation: Given in the format U i s, where you update the i-th product's status to s (either A or N).
  • Query Operation: Given in the format Q i, where you must print YES if the i-th product is available (i.e. its status is A), and NO otherwise.

The operations are performed sequentially. Use stdin for input and stdout for output.

Formally, let \(N\) be the number of products, \(S\) be the initial status string, and \(M\) be the number of operations. For an update operation, if the operation is U i s, then \(S[i] = s\); for a query operation Q i, output YES if \(S[i] = A\) and NO otherwise.

inputFormat

The input is given from stdin and has the following format:

N
initial_status
M
operation_1
operation_2
... 
operation_M

Where:

  • N (an integer) is the number of products.
  • initial_status is a string of length N consisting of characters A and N.
  • M (an integer) is the number of operations.
  • Each operation is either:
    • U i s - update the status of the i-th product to s.
    • Q i - query the status of the i-th product.

outputFormat

For each query operation, output a single line containing YES if the queried product's status is A, or NO otherwise. The output should be written to stdout.

## sample
5
AANNA
2
Q 1
Q 3
YES

NO

</p>