Intersecting Rectangles

Background

Consider, in a 2D space, a set of rectangles with edges that are parallel to the axis X and Y. One is the main rectangle and there are intersections between several rectangles. According to these intersections, one or more closed polygons called "islands" can be defined. The main island is the one that contains the main rectangle.


Figure 1 - The ten rectangles are defining 3 islands

The proposed problem is to evaluate the area of the main island. For example, in Figure 1, considering that polygon 1 is the main polygon, the main island is composed by polygons 1,2,3,5 and 10, so the problem here is to evaluate the area of the polygon presented in Figure 2.


Figure 2 - The polygon defined by the main island

Problem

Given a list of rectangles, starting with the main rectangle, the problem is to identify the main island and evaluate the correspondent area. Each rectangle is geometrically characterized by the coordinates of its bottom-left and upper-right corners; the maximum number of rectangles is 100; as a simplification, it can be considered that no coincidences between edges and vertices exist.

Input

The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.

The first line of the input contains the number of rectangles N (integer format) to be considered. Each one of the following N lines contains the coordinates of bottom-left and upper-right vertices of a rectangle, in the sequence xmin ymin xmax ymax, separated by a single space. The first rectangle given is the main one.

Output

For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.

One integer number that represents the main island area as defined above.


Figure 3 - Sample input

Sample Input

1

9
2 5 8 8
4 6 10 10
5 7 6 12
9 9 11 11 12 7 15 8
1 3 3 6
4 2 8 3
13 6 14 9
2 1 11 4

Sample Output

70



University of Porto ACM Programming Contest / Round 12/ 2000