#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e5 + 5;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long a[N], b[N], c[N];
vector<long long> v;
vector<long long>::iterator itr;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, l, r, x1, x2, y1, y2, w, b, x3, x4, y3, y4;
  cin >> n;
  while (n--) {
    cin >> l >> r;
    w = (l * r) / 2 + bool((l * r) % 2);
    b = (l * r) / 2;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    if ((x1 + y1) % 2 == 0) {
      long long l1, r1;
      l1 = (y2 - y1 + 1);
      r1 = (x2 - x1 + 1);
      b -= (l1 * r1) / 2;
      w += (l1 * r1) / 2;
    } else {
      long long l1, r1;
      l1 = (y2 - y1 + 1);
      r1 = (x2 - x1 + 1);
      w += (l1 * r1) / 2 + bool((l1 * r1) % 2);
      b -= (l1 * r1) / 2 + bool((l1 * r1) % 2);
    }
    if ((x3 + y3) % 2 == 0) {
      long long l1, r1;
      l1 = (y4 - y3 + 1);
      r1 = (x4 - x3 + 1);
      w -= (l1 * r1) / 2 + bool((l1 * r1) % 2);
      b += (l1 * r1) / 2 + bool((l1 * r1) % 2);
    } else {
      long long l1, r1;
      l1 = (y4 - y3 + 1);
      r1 = (x4 - x3 + 1);
      w -= (l1 * r1) / 2;
      b += (l1 * r1) / 2;
    }
    {
      long long l1, r1, l2, r2;
      l1 = max(x1, x3);
      r1 = max(y1, y3);
      l2 = min(x2, x4);
      r2 = min(y2, y4);
      if (l1 <= l2 && r1 <= r2) {
        if ((l1 + r1) % 2 == 0) {
          l1 = (l2 - l1 + 1);
          r1 = (r2 - r1 + 1);
          b += (l1 * r1) / 2;
          w -= (l1 * r1) / 2;
        } else {
          l1 = (l2 - l1 + 1);
          r1 = (r2 - r1 + 1);
          w -= (l1 * r1) / 2 + bool((l1 * r1) % 2);
          b += (l1 * r1) / 2 + bool((l1 * r1) % 2);
        }
      }
    }
    cout << w << " " << b << endl;
  }
  return 0;
}
long long pwr(long long x, long long y) {
  long long ans = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = (x * x) % mod;
    y = y / 2;
  }
  return ans;
}
bool isprime(long long x) {
  if (x < 2) return false;
  if (x < 4) return true;
  if (x % 2 == 0 || x % 3 == 0) return false;
  for (long long i = 5; i * i <= x; i += 6) {
    if (x % i == 0 || x % (i + 2) == 0) return false;
  }
  return true;
}
