#B3683. String Equality Queries

    ID: 11342 Type: Default 1000ms 256MiB

String Equality Queries

String Equality Queries

You are given two strings \(s\) and \(t\) of length \(n\). Initially, you need to check whether the two strings are identical. Then, you will be given \(q\) operations. In each operation, you modify a single character in either \(s\) or \(t\). After each operation, output whether \(s\) and \(t\) are identical.

The strings are 1-indexed. For example, if \(s = \texttt{abc}\) and you modify the second character to \(d\), the string becomes \(\texttt{adc}\).

inputFormat

The input is given as follows:

n
s
t
q
op1
op2
... 
opq

where:

  • \(n\) is the length of the strings \(s\) and \(t\).
  • The next two lines contain the strings \(s\) and \(t\) respectively.
  • \(q\) is the number of operations.
  • Each operation \(op_i\) consists of three inputs separated by spaces: a character indicating which string to update (either s or t), an integer \(i\) (1-indexed) indicating the position, and a character that is the new value at that position.

outputFormat

After each operation, output a single line containing Yes if the two strings are identical, or No otherwise.

sample

3
abc
abc
2
s 2 d
t 3 e
No

No

</p>