#include <bits/stdc++.h>
const int MAX = 2e5 + 10;
const int MOD = 1e9 + 7;
using namespace std;
int t;
long long n, m;
long long x[5], y[5];
int main() {
  ios::sync_with_stdio(false), cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long ans1 = (n * m) / 2, ans2 = (n * m) / 2;
    if ((n + 1) % 2 == 0 && (m + 1) % 2 == 0) ans1++;
    cin >> x[1] >> y[1] >> x[2] >> y[2];
    cin >> x[3] >> y[3] >> x[4] >> y[4];
    long long sz1 = (x[2] - x[1] + 1) * (y[2] - y[1] + 1),
              sz2 = (x[4] - x[3] + 1) * (y[4] - y[3] + 1);
    long long sum1 = sz1 / 2, sum2 = sz2 / 2;
    if (sz1 % 2 == 1 && (x[1] + y[1]) % 2 == 1) sum1++;
    if (sz2 % 2 == 1 && (x[3] + y[3]) % 2 == 0) sum2++;
    long long x1 = max(x[1], x[3]), y1 = max(y[1], y[3]);
    long long x2 = min(x[2], x[4]), y2 = min(y[2], y[4]);
    long long sum = 0, sz;
    if (x2 >= x1 && y2 >= y1) {
      sz = (x2 - x1 + 1) * (y2 - y1 + 1);
      sum = sz / 2;
      if (sz % 2 == 1 && (x1 + y1) % 2 == 1) sum++;
    }
    sum1 -= sum;
    ans1 = ans1 + sum1 - sum2;
    ans2 = ans2 + sum2 - sum1;
    cout << ans1 << " " << ans2 << endl;
  }
}

### Prompt

Generate a Cpp solution to the following problem:

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>

### Response

```cpp
#include <bits/stdc++.h>
const int MAX = 2e5 + 10;
const int MOD = 1e9 + 7;
using namespace std;
int t;
long long n, m;
long long x[5], y[5];
int main() {
  ios::sync_with_stdio(false), cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long ans1 = (n * m) / 2, ans2 = (n * m) / 2;
    if ((n + 1) % 2 == 0 && (m + 1) % 2 == 0) ans1++;
    cin >> x[1] >> y[1] >> x[2] >> y[2];
    cin >> x[3] >> y[3] >> x[4] >> y[4];
    long long sz1 = (x[2] - x[1] + 1) * (y[2] - y[1] + 1),
              sz2 = (x[4] - x[3] + 1) * (y[4] - y[3] + 1);
    long long sum1 = sz1 / 2, sum2 = sz2 / 2;
    if (sz1 % 2 == 1 && (x[1] + y[1]) % 2 == 1) sum1++;
    if (sz2 % 2 == 1 && (x[3] + y[3]) % 2 == 0) sum2++;
    long long x1 = max(x[1], x[3]), y1 = max(y[1], y[3]);
    long long x2 = min(x[2], x[4]), y2 = min(y[2], y[4]);
    long long sum = 0, sz;
    if (x2 >= x1 && y2 >= y1) {
      sz = (x2 - x1 + 1) * (y2 - y1 + 1);
      sum = sz / 2;
      if (sz % 2 == 1 && (x1 + y1) % 2 == 1) sum++;
    }
    sum1 -= sum;
    ans1 = ans1 + sum1 - sum2;
    ans2 = ans2 + sum2 - sum1;
    cout << ans1 << " " << ans2 << endl;
  }
}

```