#ABC475E. 问答预赛晋级者 / Quiz Competition: Qualifiers

问答预赛晋级者 / Quiz Competition: Qualifiers

Problem Statement

A preliminary round of a quiz competition was held. There are NN participants, numbered 11 to NN, and at most MM of them can pass the preliminary round.

The preliminary round consists of KK two-choice quiz questions, and the answer to each question is o or x. Participant ii's answer to the jj-th question is given as the jj-th character of the string SiS_i. The correct answer to the jj-th question is given as the jj-th character of the string TT.

The qualifiers are determined by the following procedure.

  • Initially, the numbers of qualifiers and non-qualifiers are both 00; all NN participants are undetermined.
  • For k=1,2,…,Kk=1,2,\dots,K in this order, perform the following process.
    • If the number of qualifiers plus the number of undetermined participants who answered the kk-th question correctly is at most MM, then all undetermined participants who answered the kk-th question correctly become qualifiers.
    • Otherwise, all undetermined participants who answered the kk-th question incorrectly become non-qualifiers.
  • All remaining undetermined participants become non-qualifiers.

You are given QQ queries in the following format. Process them in order.

  • Integers ii and jj are given. Change participant ii's answer to the jj-th question from o to x, or from x to o. Then, determine whether participant ii passes the preliminary round.

The change of the answer in each query remains in effect when processing subsequent queries as well.

Constraints

  • 1≤M≤N≤3×1041 \leq M \leq N \leq 3\times 10^4
  • 1≤K≤2001 \leq K \leq 200
  • SiS_i and TT are strings of length KK consisting of o and x.
  • 1≤Q≤5×1041 \leq Q \leq 5\times 10^4
  • For each query, 1≤i≤N1\leq i \leq N and 1≤j≤K1 \leq j \leq K.
  • All input values are integers.

Input

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

  • NN MM KK
  • TT
  • S1S_1
  • ⋮\vdots
  • SNS_N
  • QQ
  • query1\mathrm{query}_1
  • ⋮\vdots
  • queryQ\mathrm{query}_Q

Here, queryq\mathrm{query}_q represents the qq-th query, and is given in the following format:

  • ii jj

Output

Output QQ lines. The qq-th line should contain Yes if the participant specified in the qq-th query passes the preliminary round, and No otherwise.

5 3 3
oxo
oxo
oxx
xxo
xox
xoo
3
5 1
1 3
4 1
Yes
Yes
No
  • Before the first query, participants 1,21,2 pass on the first question and participant 33 passes on the second question, so the qualifiers are the three participants 1,2,31,2,3.
  • After the first query, participants 1,2,51,2,5 pass on the first question, so the qualifiers are the three participants 1,2,51,2,5. Since participant 55 passes the preliminary round, output Yes.
  • After the second query, participants 1,2,51,2,5 still pass on the first question, so the qualifiers are the three participants 1,2,51,2,5. Since participant 11 passes the preliminary round, output Yes.
  • After the third query, participant 33 is eliminated on the first question, participants 1,21,2 pass on the second question, and participant 55 passes on the third question, so the qualifiers remain the three participants 1,2,51,2,5. Since participant 44 does not pass the preliminary round, output No.
3 1 2
ox
xo
oo
ox
4
3 1
1 1
2 2
1 2
No
No
Yes
No
1 1 1
o
o
2
1 1
1 1
No
Yes