By the year 3002, the notorious Godfather Unlucky Luchiano is planning a heist at the Rectilinia Museum. The museum's walls are impenetrable and every door is guarded, so his men cannot get in from the sides. Fortunately for him, the museum has no roof, so one can drop in from above. He decides to use an ancient device — a catapult — to fling his men over the walls so they land somewhere inside without passing any guard.
There is still one problem: a high-tech laser gun guards the museum. This gun can steer its beam along a rectilinear (axis-aligned) path rather than a straight line, and the beam always travels the shortest possible distance from the gun to its target. Anyone who lands on a spot the beam can reach is destroyed instantly. Again the Godfather is lucky: the museum contains walls and other obstacles that the beam cannot pass through. If his men land in the shadow of these obstacles — a spot no beam can reach — they survive and can disable the gun. Because the catapult is imprecise, the Godfather wants the total area of the shadowy (safe) regions.
Seen from above, the museum is a rectangle containing several obstacles. Each obstacle is a simple polygon whose sides are parallel to the rectangle's sides, and no two obstacle interiors overlap. The laser gun sits in the upper-right corner of the museum. A beam is a sequence of horizontal and vertical segments. When the gun picks a target, it chooses a valid path and fires. A valid path satisfies:

Compute the total area of the shadowy regions — the parts of the museum that lie outside every obstacle yet no beam can reach. In the figure above, the point marked (×) lies in a shadowy region.
The first line contains an integer t (1≤t≤10), the number of test cases. Each test case is given as follows.
Every coordinate is a non-negative integer less than 1,000,000. The upper-left corner of the rectangle is the origin, the x-axis points right, and the y-axis points down.
For each test case, print a single line containing one integer: the total area of the safe (shadowy) regions — the region inside the museum, outside every obstacle, that the laser gun cannot reach. Each answer is guaranteed to fit in a 32-bit integer.