#include <bits/stdc++.h>
using namespace std;
long long getW(long long x1, long long y1, long long x2, long long y2) {
  long long n = x2 - x1 + 1, m = y2 - y1 + 1;
  if ((!(n & 1)) || (!(m & 1)))
    return (n * m) >> 1;
  else if ((x1 + y1) & 1)
    return n * m / 2;
  else
    return n * m / 2 + 1;
}
long long getB(long long x1, long long y1, long long x2, long long y2) {
  long long n = x2 - x1 + 1, m = y2 - y1 + 1;
  return n * m - getW(x1, y1, x2, y2);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long x1, x2, x3, x4, y1, y2, y3, y4, n, m;
    scanf("%lld%lld", &n, &m);
    scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);
    scanf("%lld%lld%lld%lld", &x3, &y3, &x4, &y4);
    long long a1 = getB(x1, y1, x2, y2), a2 = getW(x3, y3, x4, y4);
    long long ans = getW(1, 1, n, m) + a1 - a2;
    long long minx = min(x2, x4), miny = min(y2, y4), maxx = max(x1, x3),
              maxy = max(y1, y3);
    if (minx >= maxx && miny >= maxy) ans -= getB(maxx, maxy, minx, miny);
    printf("%lld %lld\n", ans, n * m - ans);
  }
  return 0;
}
