Problem E: Chainsaw Massacre 

Background 

As every year the Canadian Lumberjack Society has just held its annual woodcutting competition and the national forests between Montreal and Vancouver are devastated. Now for the social part! In order to lay out an adequate dance floor for the evening party the organizing committee is looking for a large rectangular area without trees. Naturally, all lumberjacks are already drunk and nobody wants to take the risk of having any of them operate a chainsaw.

The Problem 

The organizing committee has asked you to find the largest yet free rectangle which could serve as the dance floor. The area in which you should search is also rectangular and the dance floor must be entirely located in that area. Its sides should be parallel to the borders of the area. It is allowed that the dance floor is located at the borders of the area and also that trees grow on the borders of the dance floor. What is the maximum size of the dance floor?

The Input 

The first line of the input specifies the number of scenarios. For each scenario, the first line provides the length l and width w of the area in meters ( $0<l,w\leq 10000$, both integers). Each of the following lines describes either a single tree, or a line of trees according to one of the following formats:

The coordinates x, y, dx, and dy are given as integers. It is guaranteed that all the trees are situated in the area, i.e. have coordinates in $[0,l]\times[0,w]$. There will be at most 1000 trees.

The Output 

For each scenario print a line containing the maximum size of the dance floor measured in square meters.

Sample Input 

2
2 3
0
10 10
2 1 1 8 0
2 1 9 8 0
0

Sample Output 

6
80



Miguel Revilla
2000-11-19