#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    long long x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> n >> m;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    long long ans1 = 0;
    long long ans2 = 0;
    if (n % 2 == 1 && m % 2 == 1) {
      ans1 = n * m / 2 + 1;
      ans2 = n * m / 2;
    } else {
      ans1 = n * m / 2;
      ans2 = n * m / 2;
    }
    if ((x1 + y1) % 2 == 0) {
      ans1 += (x2 - x1 + 1) * (y2 - y1 + 1) / 2;
      ans2 -= (x2 - x1 + 1) * (y2 - y1 + 1) / 2;
    } else {
      if ((x2 - x1 + 1) % 2 == 1 && (y2 - y1 + 1) % 2 == 1) {
        ans1 += ((x2 - x1 + 1) * (y2 - y1 + 1) / 2 + 1);
        ans2 -= ((x2 - x1 + 1) * (y2 - y1 + 1) / 2 + 1);
      } else {
        ans1 += (x2 - x1 + 1) * (y2 - y1 + 1) / 2;
        ans2 -= (x2 - x1 + 1) * (y2 - y1 + 1) / 2;
      }
    }
    if ((x3 + y3) % 2) {
      ans1 -= (x4 - x3 + 1) * (y4 - y3 + 1) / 2;
      ans2 += (x4 - x3 + 1) * (y4 - y3 + 1) / 2;
    } else {
      if ((x4 - x3 + 1) % 2 == 1 && (y4 - y3 + 1) % 2 == 1) {
        ans1 -= ((x4 - x3 + 1) * (y4 - y3 + 1) / 2 + 1);
        ans2 += ((x4 - x3 + 1) * (y4 - y3 + 1) / 2 + 1);
      } else {
        ans1 -= ((x4 - x3 + 1) * (y4 - y3 + 1) / 2);
        ans2 += ((x4 - x3 + 1) * (y4 - y3 + 1) / 2);
      }
    }
    long long n1, n2, m1, m2;
    n1 = min(max(x1, x2), max(x3, x4));
    m1 = min(max(y1, y2), max(y3, y4));
    n2 = max(min(x1, x2), min(x3, x4));
    m2 = max(min(y1, y2), min(y3, y4));
    if (n1 >= n2 && m1 >= m2) {
      if ((n2 + m2) % 2 == 0) {
        ans1 -= (n1 - n2 + 1) * (m1 - m2 + 1) / 2;
        ans2 += (n1 - n2 + 1) * (m1 - m2 + 1) / 2;
      } else {
        if ((n1 - n2 + 1) % 2 == 1 && (m1 - m2 + 1) % 2 == 1) {
          ans1 -= ((n1 - n2 + 1) * (m1 - m2 + 1) / 2 + 1);
          ans2 += ((n1 - n2 + 1) * (m1 - m2 + 1) / 2 + 1);
        } else {
          ans1 -= (n1 - n2 + 1) * (m1 - m2 + 1) / 2;
          ans2 += (n1 - n2 + 1) * (m1 - m2 + 1) / 2;
        }
      }
    }
    cout << ans1 << " " << ans2 << endl;
  }
  return 0;
}
