#### Registered Users Only

Please login to view and utilize this feature.

## Problem Description

Jianzhi is preparing Christmas lights for his annual Christmas party. To decorate his backyard, Jianzhi has arranged his lights in an *N* by *M* grid. At first, all of Jianzhi's lights are turned off.

As arranging lights are very boring, Jianzhi decides to test out his magical skills. He issues a series of *Q* spells, and the *i*th spell toggles all the lights within the rectangle bounded by (*A _{i}*,

*B*) and (

_{i}*C*,

_{i}*D*). Jianzhi wants to know, after all spells have been casted, which lights are turned on and which lights are turned off.

_{i}## Input

The first line of input will contain three integers, *N*, *M* and *Q*.

The next *Q* lines of input will contain four integers each, *A _{i}*,

*B*,

_{i}*C*and

_{i}*D*.

_{i}## Output

The output should contain *N* lines with *M* integers each, representing the configuration of the lights after Jianzhi's spells. A 0 represents a light that is off, and a 1 represents a light that is on.

## Limits

For all subtasks: 1 ≤ N, M ≤ 2 000, 1 ≤ Q ≤ 3 000 000, 0 ≤ A_{i} ≤ C_{i} < N, 0 ≤ B_{i} ≤ D_{i} < M.

Subtask 1 (7%): N = 1, Q ≤ 2 000.

Subtask 2 (11%): N = 1, B_{i} < D_{j} for all i, j.

Subtask 3 (19%): N = 1.

Subtask 4 (18%): N, M ≤ 50, Q ≤ 2 000.

Subtask 5 (22%): Q ≤ 2 000.

Subtask 6 (14%): Q ≤ 100 000.

Subtask 7 (9%): No additional constraints.

Subtask 8 (0%): Sample Testcases.

## Sample Input 1

1 5 3 0 1 0 3 0 2 0 4 0 0 0 0

## Sample Output 1

1 1 0 0 1

## Sample Input 2

3 3 2 0 1 1 2 1 0 2 1

## Sample Output 2

0 1 1 1 0 1 1 1 0

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 7 | 21 | 3s | 256MB | Minimum |

2 | 11 | 20 | 3s | 256MB | Minimum |

3 | 19 | 61 | 3s | 256MB | Minimum |

4 | 18 | 22 | 3s | 256MB | Minimum |

5 | 22 | 62 | 3s | 256MB | Minimum |

6 | 14 | 82 | 3s | 256MB | Minimum |

7 | 9 | 142 | 3s | 256MB | Minimum |

8 | 0 | 2 | 3s | 256MB | Minimum |

### Judge Compile Command

g++ ans.cpp -o lightsflip -Wall -static -O2 -lm -m64 -s -w -std=gnu++14 -fmax-errors=512