#include <bits/stdc++.h>
using namespace std;
int check(long long a, long long b, long long c, long long d) {
  if (((c - a + 1) * (d - b + 1)) & 1) {
    if ((a & 1) == (b & 1))
      return 1;
    else
      return -1;
  } else {
    return 0;
  }
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  int _;
  cin >> _;
  while (_--) {
    long long n, m;
    cin >> n >> m;
    long long x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long ans1 = 0, ans2 = 0;
    if (n * m % 2) {
      ans1 = n * m / 2 + 1;
      ans2 = n * m / 2;
    } else {
      ans1 = ans2 = n * m / 2;
    }
    long long a, b, c, d;
    bool flag = true;
    a = max(x1, x3);
    b = max(y1, y3);
    c = min(x2, x4);
    d = min(y2, y4);
    if (a > c || b > d) flag = false;
    if (flag) {
      long long sum = (c - a + 1) * (d - b + 1);
      ans1 -= sum;
      int res = check(a, b, c, d);
      if (res == 0) {
        ans1 += sum / 2;
        ans2 += sum / 2;
      } else if (res == 1) {
        ans1 += sum / 2 + 1;
        ans2 += sum / 2;
      } else if (res == -1) {
        ans1 += sum / 2;
        ans2 += sum / 2 + 1;
      }
      sum = (x2 - x1 + 1) * (y2 - y1 + 1);
      ans1 += sum;
      res = check(x1, y1, x2, y2);
      if (res == 0) {
        ans1 -= sum / 2;
        ans2 -= sum / 2;
      } else if (res == 1) {
        ans1 -= sum / 2 + 1;
        ans2 -= sum / 2;
      } else if (res == -1) {
        ans1 -= sum / 2;
        ans2 -= sum / 2 + 1;
      }
      sum = (x4 - x3 + 1) * (y4 - y3 + 1);
      res = check(x3, y3, x4, y4);
      if (res == 0) {
        ans1 -= sum / 2;
        ans2 -= sum / 2;
      } else if (res == 1) {
        ans1 -= sum / 2 + 1;
        ans2 -= sum / 2;
      } else if (res == -1) {
        ans1 -= sum / 2;
        ans2 -= sum / 2 + 1;
      }
      ans2 += sum;
    } else {
      long long sum = (x2 - x1 + 1) * (y2 - y1 + 1);
      ans1 += sum;
      int res = check(x1, y1, x2, y2);
      if (res == 0) {
        ans1 -= sum / 2;
        ans2 -= sum / 2;
      } else if (res == 1) {
        ans1 -= sum / 2 + 1;
        ans2 -= sum / 2;
      } else if (res == -1) {
        ans1 -= sum / 2;
        ans2 -= sum / 2 + 1;
      }
      sum = (x4 - x3 + 1) * (y4 - y3 + 1);
      res = check(x3, y3, x4, y4);
      if (res == 0) {
        ans1 -= sum / 2;
        ans2 -= sum / 2;
      } else if (res == 1) {
        ans1 -= sum / 2 + 1;
        ans2 -= sum / 2;
      } else if (res == -1) {
        ans1 -= sum / 2;
        ans2 -= sum / 2 + 1;
      }
      ans2 += sum;
    }
    cout << ans1 << ' ' << ans2 << '\n';
  }
  return 0;
}
