Problem E: Chainsaw Massacre |
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 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 (
,
both integers). Each of
the following lines describes either a single tree, or a line of trees
according to one of the following formats:
1 x y
, where the ``one'' characterizes a single tree, and
x and y provide its coordinates in meters with respect to the upper left
corner.
k x y dx dy
, where k>1 provides the number of trees in a line with
coordinates
0
denotes the end of the scenario.
For each scenario print a line containing the maximum size of the dance floor measured in square meters.
2 2 3 0 10 10 2 1 1 8 0 2 1 9 8 0 0
6 80