#include <bits/stdc++.h>
using namespace std;
long long t, n, m;
long long a, b, c, d, e, f, g, h;
pair<long long, long long> aux(long long x1, long long x2, long long x3,
                               long long x4) {
  long long area = (x3 - x1 + 1) * (x4 - x2 + 1);
  long long cl, fl;
  if (area % 2 == 0)
    cl = fl = area / 2;
  else {
    cl = area / 2 + 1;
    fl = cl - 1;
  }
  long long w, b;
  if ((x1 + x2) % 2 == 0) {
    w = cl;
    b = fl;
  } else {
    b = cl;
    w = fl;
  }
  return make_pair(w, b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    long long aux1[4] = {a, c, e, g};
    long long aux2[4] = {b, d, f, h};
    sort(aux1, aux1 + 4);
    sort(aux2, aux2 + 4);
    pair<long long, long long> orig = aux(1, 1, m, n);
    pair<long long, long long> newW = aux(a, b, c, d);
    orig.first += newW.second;
    orig.second -= newW.second;
    pair<long long, long long> newB = aux(e, f, g, h);
    orig.first -= newB.first;
    orig.second += newB.first;
    if (!(c < e || g < a || d < f || h < b)) {
      pair<long long, long long> inters =
          aux(aux1[1], aux2[1], aux1[2], aux2[2]);
      orig.first -= inters.second;
      orig.second += inters.second;
    }
    cout << orig.first << ' ' << orig.second << endl;
  }
  return 0;
}
