#K296. Grid Update Instructions

    ID: 24852 Type: Default 1000ms 256MiB

Grid Update Instructions

Grid Update Instructions

You are given a 2D grid with dimensions n rows and m columns, initially filled with zeroes. You will be provided with a series of instructions. Each instruction is given as a tuple \( (x_1, y_1, x_2, y_2) \) representing the top-left and bottom-right coordinates (inclusive) of a sub-grid. For every instruction, you must add 1 to every cell in the specified sub-grid, i.e., update each cell \( grid[i][j] \) such that:

[ grid[i][j] = grid[i][j] + 1 ]

Your task is to output the final grid after processing all the instructions.

inputFormat

The first line contains two integers n and m representing the number of rows and columns of the grid respectively.

The second line contains a single integer k representing the number of instructions.

The following k lines each contain 4 space-separated integers: x1 y1 x2 y2, where \(1 \leq x1 \leq x2 \leq n\) and \(1 \leq y1 \leq y2 \leq m\).

outputFormat

Output the final grid after applying all the instructions. Each of the n rows should be printed on a new line with the m integers separated by spaces.

## sample
3 3
2
1 1 2 2
2 2 3 3
1 1 0

1 2 1 0 1 1

</p>