Visible Poster Area

Time limit1sMemory limit128 MB

Problem

For a fall festival, Sangwon from the film club put a screening poster on a department bulletin board. When he came back later, another club had placed an event poster on top of it, covering part of the first poster.

Both posters are rectangles, and every side is parallel to either the horizontal or vertical direction of the board. The position of each poster is given by the coordinates of its lower-left and upper-right corners.

Find the area of the first poster that remains visible after the second poster is placed on top of it.

Input

The first line contains the number of test cases T.

Each test case consists of one line with eight integers x1, y1, x2, y2, x3, y3, x4, y4.

(x1, y1) and (x2, y2) are the lower-left and upper-right corners of the first poster. (x3, y3) and (x4, y4) are the lower-left and upper-right corners of the poster placed on top of it.

The coordinates satisfy the following constraints.

  • 1 <= x1 < x2 <= 10000
  • 1 <= y1 < y2 <= 10000
  • 1 <= x3 < x4 <= 10000
  • 1 <= y3 < y4 <= 10000

Output

For each test case, output one line containing the visible area of the first poster.