#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> per(pair<long long, long long> otr1,
                               pair<long long, long long> otr2) {
  if (otr1 > otr2) swap(otr1, otr2);
  long long ans = 0;
  if (otr2.first > otr1.second) return make_pair(-1, -1);
  return make_pair(otr2.first, min(otr2.second, otr1.second));
}
long long check(long long n, long long m, long long cl, long long nuzhen) {
  n++;
  m++;
  long long bel = 0;
  if (m % 2 == 0) {
    bel = n * (m / 2);
  } else {
    bel = (n + 1) / 2 * ((m + 1) / 2) + (n / 2) * (m / 2);
  }
  return (cl == nuzhen ? bel : n * m - bel);
}
long long pl_prya(pair<long long, long long> x1, pair<long long, long long> y1,
                  pair<long long, long long> x2,
                  pair<long long, long long> y2) {
  pair<long long, long long> x = per(x1, x2);
  pair<long long, long long> y = per(y1, y2);
  if (x.first == -1 || y.first == -1) return 0;
  return check(y.second - y.first, x.second - x.first, (x.first + y.first) % 2,
               1);
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long bel, che;
    bel = check(n - 1, m - 1, 0, 0);
    che = n * m - bel;
    che = che - check(y2 - y1, x2 - x1, (x1 + y1) % 2, 1);
    bel = bel + check(y2 - y1, x2 - x1, (x1 + y1) % 2, 1);
    che += pl_prya(make_pair(x1, x2), make_pair(y1, y2), make_pair(x3, x4),
                   make_pair(y3, y4));
    bel -= pl_prya(make_pair(x1, x2), make_pair(y1, y2), make_pair(x3, x4),
                   make_pair(y3, y4));
    che = che + check(y4 - y3, x4 - x3, (x3 + y3) % 2, 0);
    bel = bel - check(y4 - y3, x4 - x3, (x3 + y3) % 2, 0);
    cout << bel << " " << che << endl;
  }
}
