You are given a matrix M of dimension N*N. All the cells are initially, zero.

You are given Q queries, which contains 4 integers

a b c d.

where (a,b) is the TOP LEFT cell and (c,d) is the Bottom Right cell of a submatrix.

Now, all the cells of This submatrix has to be incremented by one.

After all the Q queries have been performed. Your task is to print the final resulting Matrix.

NOTE: ZERO-Based Indexing is used for cells of the matrix.

**Input:**

The first line contains an integer T-denoting the number of testcases.

Each test case contains N-size of the matrix and Q- Total number of queries.

Each of the next Q lines contains 4 integers- a,b,c,d as described above.

**Output:**

For each testcase , Print the final resulting Matrix.

**Constraints:
1<=T<=100
1<=N<=100
1<=Q<=1000
0<=a,b,c,d c>=a ,d>=b **

Input:

1

6 6

4 0 5 3

0 0 3 4

1 2 1 2

1 1 2 3

0 0 3 1

1 0 2 4

Output:

2 2 1 1 1 0

3 4 4 3 2 0

3 4 3 3 2 0

2 2 1 1 1 0

1 1 1 1 0 0

1 1 1 1 0 0

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

RatneshTiwari3 | 24 |

AnmolPassi | 20 |

Swords | 20 |

baranwalsuraj96 | 17 |

tarun711 | 16 |

Bishnu Dev Panda | 727 |

yk12 | 512 |

DevMittal | 472 |

okayboss | 458 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4921 |

Quandray | 4547 |

Login to report an issue on this page.