#include <bits/stdc++.h>
using namespace std;
vector<long long> solve(long long x1, long long y1, long long x2,
                        long long y2) {
  long long totw, totb;
  totb = totw = 0;
  long long here = (x1 - 1) + (y1 - 1);
  bool st = false;
  if (here % 2 == 0) st = true;
  long long n, m;
  n = y2 - y1 + 1;
  m = x2 - x1 + 1;
  totw = totb = (m / 2) * n;
  if (m % 2) {
    totw += n / 2;
    totb += n / 2;
    if (n % 2) {
      if (st)
        totw++;
      else
        totb++;
    }
  }
  vector<long long> v;
  v.push_back(totw);
  v.push_back(totb);
  if (x2 < x1 || y2 < y1) {
    v[0] = v[1] = 0;
  }
  return v;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> q;
  while (q--) {
    long long n, m;
    cin >> n >> m;
    long long totw, totb;
    vector<long long> v = solve(1, 1, m, n);
    totw = v[0];
    totb = v[1];
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    vector<long long> b = solve(x1, y1, x2, y2);
    totb -= b[1];
    totw += b[1];
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    long long area = max(
        0LL, (min(x2, x4) - max(x1, x3) + 1) * (min(y2, y4) - max(y1, y3) + 1));
    if (min(x2, x4) < max(x1, x3) || min(y2, y4) < max(y1, y3)) area = 0;
    if (area == 0) {
      vector<long long> c = solve(x3, y3, x4, y4);
      totw -= c[0];
      totb += c[0];
    } else {
      vector<long long> c = solve(x3, y3, x4, y4);
      vector<long long> d =
          solve(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
      long long tw = c[0] - d[0];
      long long tb = c[1] - d[1];
      totw -= tw;
      totb += tw;
      totw -= area;
      totb += area;
    }
    cout << totw << " " << totb << '\n';
  }
  return 0;
}
