Cherry has a binary matrix $A$ consisting of $N$ rows and $M$ columns. The rows are numbered from $1$ to $N$, columns are numbered from $1$ to $M$. Element at row $i$ ($1$ ≤ $i$ ≤ $N$) and column $j$ ($1$ ≤ $j$ ≤ $M$) is denoted as $A_{ij}$. All elements of $A$ are either $0$ or $1$.
He performs $Q$ queries on matrix. Each query is provided by four integers $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$ which define the rectangle, where ($x_{1}$, $y_{1}$) stands for the coordinates of the top left cell of the rectangle, while ($x_{2}$, $y_{2}$) stands for the coordinates of the bottom right cell. You need to flip all the bits i.e. ($0$ to $1$, $1$ to $0$) that are located fully inside the query rectangle.
Finally, print the matrix after performing all the queries.
Note: $x_{1}$ represents the row number while $y_{1}$ represents the column number.

-----Input:-----
- The first line of the input contains two integers $N$ and $M$ — the number of rows and the number of columns in the matrix.
- Each of the next $N$ lines contains a string of length $M$, where the $j^{th}$ character of $i^{th}$ line denotes the value of $A_{i,j}$. 
- Next line contains an integer $Q$ — the number of queries.
- Then follow $Q$ lines with queries descriptions. Each of them contains four space-seperated integers $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$ — coordinates of the up left and bottom right cells of the query rectangle.

-----Output:-----
Print the matrix, in the form of $N$ strings, after performing all the queries.

-----Constraints-----
- $1 \leq N,M \leq 1000$
- $0 \leq  A_{ij}  \leq 1$
- $1 \leq Q \leq 10^6$
- $1 \leq x_{1} \leq x_{2} \leq N$
- $1 \leq y_{1} \leq y_{2} \leq M$

-----Sample Input:-----
2 2
00
00
3
1 1 1 1
2 2 2 2
1 1 2 2 

-----Sample Output:-----
01
10

-----Explanation:-----
Example case 1:
After processing the 1st query 1 1 1 1, matrix becomes:
[1000][1000]\begin{bmatrix} 10 \\ 00  \end{bmatrix}
After processing the 2nd query 2 2 2 2, the matrix becomes:
[1001][1001]\begin{bmatrix} 10 \\ 01  \end{bmatrix}
After processing the 3rd query 1 1 2 2, matrix becomes:
[0110][0110]\begin{bmatrix} 01 \\ 10  \end{bmatrix}
We need to output the matrix after processing all queries.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import sys\ndef get_array(): return list(map(int , sys.stdin.readline().strip().split()))\ndef get_ints(): return map(int, sys.stdin.readline().strip().split())\ndef input(): return sys.stdin.readline().strip()\nimport math\nfrom collections import defaultdict\n\nn, m = get_ints()\na = []\narr = [[0 for _ in range(m+2)] for _ in range(n+2)]\nfor _ in range(n):\n  # t = get_array()\n t = list(input())\n # t.append(\'0\')\n a.append(t)\n\nfor i in range(n):\n for j in range(m):\n  a[i][j] = int(a[i][j])\n\n# print(a)\n# print(arr)\n\n\nq = int(input())\nfor _ in range(q):\n x1,y1,x2,y2 = get_ints()\n # x1-=1\n # y1-=1\n # x2-=1\n # y2-=1\n arr[x1][y1]+=1\n arr[x2+1][y2+1]+=1\n arr[x1][y2 + 1]-=1\n arr[x2 + 1][y1]-=1\n\n# print("hello ",arr)\n\nfor i in range(1,n+1):\n for j in range(1,m+1):\n  arr[i][j] += arr[i - 1][j] + arr[i][j - 1] - arr[i - 1][j - 1]\n  if(a[i-1][j-1] == 0 and arr[i][j]%2==0):\n   a[i-1][j-1] = 0\n  elif(a[i-1][j-1] == 1 and arr[i][j]%2 == 0):\n   a[i-1][j-1] = 1\n  elif(a[i-1][j-1] == 0 and arr[i][j]%2==1):\n   a[i-1][j-1] = 1\n  elif(a[i-1][j-1] == 1 and arr[i][j]%2==1):\n   a[i-1][j-1] = 0\n\n# print(arr)\n# print(a)\n\nfor i in range(n):\n for j in range(m):\n  print(a[i][j],end = "")\n print()\n\n# for i in range(n):\n#     print(\'\'.join(map(str,a[i])))\n\n\n\n\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15667