# Largest Block

Consider a n × n chessboard. The term block(r1, c1, r2, c2) denotes the rectangular subset of squares defined by the intersection of rows {r1,r1+1,...,r2} and columns {c1,c1+1,...,c2}. There are several occupied blocks on the board. We are interested in the largest block (in the sense of maximum area) that can be placed in the free space remaining in the board. For example, in a chessboard of size 10, if block(2, 2, 5, 3), block(8, 3, 9, 7), and block(3, 6, 3, 8) rep- resent occupied space, then the largest block that can be placed in free space has area 28. This can be visually checked in the following figure: r\c 1 2 3 4 5 6 7 8 9 10 1 2XX 3XXXXX 4 XXooooooo 5 XXooooooo 6 ooooooo 7 ooooooo 8 XXXXX 9 XXXXX 10 We are interested only in the area of the largest free block, and not in its particular location. Therefore, each instance of the problem has a unique solution. Input The program first reads the number p of instances of the problem. Each instance is described by the size s of the board, the number b of blocks of occupied space, and the vertices r1, c1, r2, c2, of each block: p number of problem instances in the file s (board size) n (number of blocks) r1c1r2c2 (first block) r1c1r2c2 (second block) ... ... r1c1r2c2 (n-th block) s (board size) n (number of blocks) r1c1r2c2 (first block) r1c1r2c2 (second block) ... ... r1c1r2c2 (n-th block) ... . . . instance #1 instance #2 instance #p

2/2 Assumptions: • 1≤s≤100 • 0≤b≤100 • 1≤r1≤r2≤s • 1≤c1≤c2≤s • Occupied blocks may overlap. Output For each test case the output consists of a integer indicating the area of the largest block that can be located in the available free squares. Sample Input 3 10 3 2253 8397 3638 20 1 1111 10 2 5 1 5 10 1 5 10 5 Sample Output 28 380 25