1080_C. Masha and two friends
Recently, Masha was presented with a chessboard with a height of n and a width of m.

The rows on the chessboard are numbered from 1 to n from bottom to top. The columns are numbered from 1 to m from left to right. Therefore, each cell can be specified with the coordinates (x,y), where x is the column number, and y is the row number (do not mix up).

Let us call a rectangle with coordinates (a,b,c,d) a rectangle lower left point of which has coordinates (a,b), and the upper right one — (c,d).

The chessboard is painted black and white as follows:

<image> An example of a chessboard.

Masha was very happy with the gift and, therefore, invited her friends Maxim and Denis to show off. The guys decided to make her a treat — they bought her a can of white and a can of black paint, so that if the old board deteriorates, it can be repainted. When they came to Masha, something unpleasant happened: first, Maxim went over the threshold and spilled white paint on the rectangle (x_1,y_1,x_2,y_2). Then after him Denis spilled black paint on the rectangle (x_3,y_3,x_4,y_4).

To spill paint of color color onto a certain rectangle means that all the cells that belong to the given rectangle become color. The cell dyeing is superimposed on each other (if at first some cell is spilled with white paint and then with black one, then its color will be black).

Masha was shocked! She drove away from the guests and decided to find out how spoiled the gift was. For this, she needs to know the number of cells of white and black color. Help her find these numbers!

Input

The first line contains a single integer t (1 ≤ t ≤ 10^3) — the number of test cases.

Each of them is described in the following format:

The first line contains two integers n and m (1 ≤ n,m ≤ 10^9) — the size of the board.

The second line contains four integers x_1, y_1, x_2, y_2 (1 ≤ x_1 ≤ x_2 ≤ m, 1 ≤ y_1 ≤ y_2 ≤ n) — the coordinates of the rectangle, the white paint was spilled on.

The third line contains four integers x_3, y_3, x_4, y_4 (1 ≤ x_3 ≤ x_4 ≤ m, 1 ≤ y_3 ≤ y_4 ≤ n) — the coordinates of the rectangle, the black paint was spilled on.

Output

Output t lines, each of which contains two numbers — the number of white and black cells after spilling paint, respectively.

Example

Input


5
2 2
1 1 2 2
1 1 2 2
3 4
2 2 3 2
3 1 4 3
1 5
1 1 5 1
3 1 5 1
4 4
1 1 4 2
1 3 4 4
3 4
1 2 4 2
2 1 3 3


Output


0 4
3 9
2 3
8 8
4 8

Note

Explanation for examples:

The first picture of each illustration shows how the field looked before the dyes were spilled. The second picture of each illustration shows how the field looked after Maxim spoiled white dye (the rectangle on which the dye was spilled is highlighted with red). The third picture in each illustration shows how the field looked after Denis spoiled black dye (the rectangle on which the dye was spilled is highlighted with red).

In the first test, the paint on the field changed as follows:

<image>

In the second test, the paint on the field changed as follows:

<image>

In the third test, the paint on the field changed as follows:

<image>

In the fourth test, the paint on the field changed as follows:

<image>

In the fifth test, the paint on the field changed as follows:

<image>
```python
def num_sq(x,y,x2,y2):
    # b, w
    a = (abs(x2-x)+1)
    b = (abs(y2-y)+1)
    if a % 2 == 0 or b % 2 == 0:
        return (a*b // 2, a*b // 2)
    if (x+y) % 2 == 0:
        num_b = a * b // 2
        return (num_b, a * b - num_b)
    num_w = a * b // 2
    return (a * b - num_w, num_w)
def pt_in(p1, r1, r2):
    return r1[0] <= p1[0] <= r2[0] and r1[1] <= p1[1] <= r2[1]
def intc(p1, p2, p3, p4):
    x1 = max(p1[0], p3[0])
    x2 = min(p2[0], p4[0])
    y1 = max(p1[1], p3[1])
    y2 = min(p2[1], p4[1])
    if x1 <= x2 and y1 <= y2:
        return ((x1, y1), (x2, y2))
    return None

num_ = int(input())
for _ in range(num_):
    n, m = map(int, input().split())
    x1,y1,x2,y2 = map(int,input().split())
    x3,y3,x4,y4 = map(int,input().split())
    p1 = (x1,y1)
    p2 = (x2,y2)
    p3 = (x3,y3)
    p4 = (x4,y4)
    all_b, all_w = num_sq(1, 1, n, m)
    tmp = intc(p1, p2, p3, p4)
    if tmp:
        intc_1, intc_2 = tmp
        t_b, t_w = num_sq(intc_1[0], intc_1[1], intc_2[0], intc_2[1])
    b,w = num_sq(x1,y1,x2,y2)
    if tmp:
        b -= t_b
        w -= t_w
    b2,w2 = num_sq(x3,y3,x4,y4)
    if tmp:
        b2 -= t_b
        w2 -= t_w
    w_tot, b_tot = (all_w + b - w2, all_b - b + w2)
    if tmp:
        w_tot -= t_w
        b_tot += t_w
    print(w_tot, b_tot)


```