A control panel is an R by C grid of beacons, each off (0) or on (1). Pressing the beacon at (r, c) toggles that beacon and each of its four orthogonal neighbours (up, down, left, right) that lie inside the grid - each affected beacon flips between off and on. Apply a list of presses in order and report the final state. Rows and columns are 0-indexed.
Input format
Line 1: two integers R and C.
Next R lines: each a string of C characters, 0 or 1.
Next line: an integer P, the number of presses.
Next P lines: two integers , one press each.
Output format
Print R lines, each a string of C characters, the final grid.
Constraints
- 1 <= R, C <= 100
- 0 <= P <= 100000
- each press targets a cell inside the grid