#include <bits/stdc++.h>
long long getblack(int x1, int y1, int x2, int y2) {
  bool opt = (x1 + y1) & 1;
  int n = x2 - x1 + 1, m = y2 - y1 + 1;
  if (opt)
    return 1LL * n * (m / 2) + ((m & 1) ? (n / 2) + (n & 1) : 0);
  else
    return 1LL * n * (m / 2) + ((m & 1) ? (n / 2) : 0);
}
long long getwhite(int x1, int y1, int x2, int y2) {
  return 1LL * (x2 - x1 + 1) * (y2 - y1 + 1) - getblack(x1, y1, x2, y2);
}
signed main() {
  int T;
  for (scanf("%d", &T); T--;) {
    int n, m, x1, y1, x2, y2, x3, y3, x4, y4;
    scanf("%d%d", &n, &m), n ^= m ^= n ^= m;
    long long s1 = getwhite(1, 1, n, m);
    scanf("%d%d%d%d%d%d%d%d", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
    int u = std::max(x1, x3), d = std::min(x2, x4);
    int l = std::max(y1, y3), r = std::min(y2, y4);
    if (u <= d && l <= r) {
      s1 += getblack(x1, y1, x2, y2) - getblack(u, l, d, r) -
            getwhite(x3, y3, x4, y4);
    } else {
      s1 += getblack(x1, y1, x2, y2) - getwhite(x3, y3, x4, y4);
    }
    printf("%I64d %I64d\n", s1, 1LL * n * m - s1);
  }
  return 0;
}
