You are given a binary grid of size $$$N \times M$$$ (containing only '0's and '1's). You have a special ability: for any column, you can swap any two elements within that column. This means you can arrange the '0's and '1's in any column in any order you like, but you cannot move elements between different columns.
A grid is considered row-sorted if every row is sorted in non-decreasing order (i.e., all '0's appear before all '1's).
You will be given $$$Q$$$ queries. Each query consists of a cell $$$(r, c)$$$. For each query, you must first flip the value in cell $$$(r, c)$$$ of the current grid (a '0' becomes a '1', and a '1' becomes a '0'). This change is permanent and carries over to subsequent queries. After each flip, you must determine if the resulting grid can be made row-sorted using your column-swapping ability.
Each test consists of multiple test cases. The first line contains a single integer $$$T$$$ $$$(1 \le T \le 10^5)$$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains integers $$$N, M,$$$ and $$$Q$$$ ($$$1 \le N, M$$$, $$$1 \le N \times M \le 10^5$$$, $$$1 \le Q \le 10^5$$$).
The next $$$N$$$ lines of each testcase each contain a string of $$$M$$$ characters ('0' or '1'), representing the initial grid.
The next $$$Q$$$ lines each contain two integers $$$r$$$ and $$$c$$$ ($$$1 \le r \le N$$$, $$$1 \le c \le M$$$), representi ng the coordinates of the cell to flip for that query. It's guaranteed that sum of N * M overall testcases doesn't exceed $$$10^5$$$ and sum of Q doesn't exceed $$$10^5$$$
For each testcase, For each of the $$$Q$$$ queries, print Yes on a new line if the grid can be made row-sorted after the flip, and No otherwise.
55 2 311110100113 14 24 13 7 20101001011111110111001 41 62 2 411012 22 11 11 13 4 11110111011003 31 1 201 11 1
Yes Yes Yes No Yes Yes No Yes No No Yes Yes
| Name |
|---|


