CF2036C.Anya and 1100

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Anya and 1100

While rummaging through things in a distant drawer, Anya found a beautiful string ss consisting only of zeros and ones.

Now she wants to make it even more beautiful by performing qq operations on it.

Each operation is described by two integers ii (1is1 \le i \le |s|) and vv (v{0,1}v \in \{0, 1\}) and means that the ii-th character of the string is assigned the value vv (that is, the assignment si=vs_i = v is performed).

But Anya loves the number 11001100, so after each query, she asks you to tell her whether the substring "1100" is present in her string (i.e. there exist such 1is31 \le i \le |s| - 3 that sisi+1si+2si+3=1100s_{i}s_{i + 1}s_{i + 2}s_{i + 3} = \texttt{1100}).

Input

The first line contains one integer tt (1t1041 \leq t \leq 10^4) — the number of test cases.

The first line of the test case contains the string ss (1s21051 \leq |s| \leq 2 \cdot 10^5), consisting only of the characters "0" and "1". Here s|s| denotes the length of the string ss.

The next line contains an integer qq (1q21051 \leq q \leq 2 \cdot 10^5) — the number of queries.

The following qq lines contain two integers ii (1is1 \leq i \leq |s|) and vv (v{0,1}v \in \{0, 1\}), describing the query.

It is guaranteed that the sum of s|s| across all test cases does not exceed 21052 \cdot 10^5. It is also guaranteed that the sum of qq across all test cases does not exceed 21052 \cdot 10^5.

Output

For each query, output "YES", if "1100" is present in Anya's string; otherwise, output "NO".

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Samples

4
100
4
1 1
2 0
2 0
3 1
1100000
3
6 1
7 1
4 1
111010
4
1 1
5 0
4 1
5 0
0100
4
3 1
1 1
2 0
2 1
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO

在线编程 IDE

建议全屏模式获得最佳体验