#ABC473F. A/AB 插入 / A/AB Insertion

A/AB 插入 / A/AB Insertion

Problem Statement

You are given a string SS of length NN consisting of A and B. Process a total of QQ queries of the following types.

1 i c

Type 11: Change the ii-th character of SS to cc.

2 l r

Type 22: Let string TT be the string obtained by extracting the ll-th through rr-th characters of the current string SS. If it is possible to obtain string TT by the following operation, output Yes; otherwise, output No.

  • Starting from the empty string, perform the following two operations any number of times, possibly zero, in any order.
    • Choose any position in the string (possibly the beginning or the end) and insert A there.
    • Choose any position in the string (possibly the beginning or the end) and insert AB there.

Constraints

  • NN is an integer satisfying 1N5×1051 \le N \le 5 \times 10^5.
  • SS is a string of length NN consisting of A and B.
  • QQ is an integer satisfying 1Q2×1051 \le Q \le 2 \times 10^5.
  • Each given query is of type 11 or 22.
  • Queries of type 11 satisfy the following constraints:
    • ii is an integer satisfying 1iN1 \le i \le N, and
    • cc is A or B.
  • Queries of type 22 satisfy the following constraints:
    • ll and rr are integers satisfying 1lrN1 \le l \le r \le N.

Input

The input is given from Standard Input in the following format:

  • NN
  • SS
  • QQ
  • Query1{\rm Query}_1
  • Query2{\rm Query}_2
  • \vdots
  • QueryQ{\rm Query}_Q

Here, Queryi{\rm Query}_i represents the ii-th query, and the input format for a query follows the format described in the problem statement.

Output

Each time a query of type 22 is given, output the answer on one line.

10
AABBAABABB
6
2 1 10
1 5 B
2 1 10
2 6 8
1 3 A
2 1 10
Yes
No
Yes
Yes

This input contains six queries.

  • Initially, S=S= AABBAABABB.

  • For the 11-st query, T=T= AABBAABABB, obtained by extracting the 11-st through 1010-th characters of SS, can be obtained by the following steps, so output Yes.

  • Start from the empty string.

  • Insert AB at the beginning of the empty string, making the string AB.

  • Insert AB right after the 11-st character of AB, making the string AABB.

  • Insert AB at the end of AABB, making the string AABBAB.

  • Insert AB right after the 55-th character of AABBAB, making the string AABBAABB.

  • Insert AB right after the 77-th character of AABBAABB, making the string AABBAABABB.

  • For the 22-nd query, change the 55-th character of SS to B. As a result, S=S= AABBBABABB.

  • For the 33-rd query, T=T= AABBBABABB, obtained by extracting the 11-st through 1010-th characters of SS, cannot be obtained by the operation described in the problem statement, so output No.

  • For the 44-th query, T=T= ABA, obtained by extracting the 66-th through 88-th characters of SS, can be obtained by the operation described in the problem statement, so output Yes.

  • For the 55-th query, change the 33-rd character of SS to A. As a result, S=S= AAABBABABB.

  • For the 66-th query, T=T= AAABBABABB, obtained by extracting the 11-st through 1010-th characters of SS, can be obtained by the operation described in the problem statement, so output Yes.

  • Source: AtCoder ABC 473 F