#include <bits/stdc++.h>
using namespace std;
int T, X1, Y1, X2, Y2, x1, _y1, x2, _y2, s1, s2, t1, t2;
long long S(int x, int y) { return 1ll * x * y / 2; }
long long count(int x1, int _y1, int x2, int _y2) {
  return S(x2, _y2) + S(x1 - 1, _y1 - 1) - S(x2, _y1 - 1) - S(x1 - 1, _y2);
}
int xj() {
  if (s1 > x2 || x1 > s2 || _y1 > t2 || t1 > _y2) return 0;
  int a[] = {t1, t2, _y1, _y2}, b[] = {x1, x2, s1, s2};
  sort(a, a + 4), sort(b, b + 4);
  X1 = b[1], X2 = b[2], Y1 = a[1], Y2 = a[2];
  return 1;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    int n, m;
    scanf("%d%d", &n, &m);
    scanf("%d%d%d%d%d%d%d%d", &x1, &_y1, &x2, &_y2, &s1, &t1, &s2, &t2);
    if (xj()) {
      long long b = count(1, 1, m, n) - count(x1, _y1, x2, _y2) -
                    count(s1, t1, s2, t2) + count(X1, Y1, X2, Y2) +
                    1ll * (s2 - s1 + 1) * (t2 - t1 + 1);
      cout << 1ll * n * m - b << " " << b << endl;
    } else {
      long long b = count(1, 1, m, n) - count(x1, _y1, x2, _y2) -
                    count(s1, t1, s2, t2) + 1ll * (s2 - s1 + 1) * (t2 - t1 + 1);
      cout << 1ll * n * m - b << " " << b << endl;
    }
  }
  return 0;
}
