#include <bits/stdc++.h>
long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, t, x, y, z;
int main() {
  for (scanf("%lld", &t); t--;) {
    scanf("%lld%lld%lld%lld%lld%lld%lld%lld%lld%lld", &n, &m, &a, &b, &c, &d,
          &e, &f, &g, &h);
    i = a > e ? a : e, j = b > f ? b : f, k = c < g ? c : g, l = d < h ? d : h;
    x = ((c - a) % 2 == 0 && (d - b) % 2 == 0 && (a + b & 1) == 1) +
        (c - a + 1) * (d - b + 1) / 2;
    y = ((g - e) % 2 == 0 && (h - f) % 2 == 0 && (e + f & 1) == 0) +
        (g - e + 1) * (h - f + 1) / 2;
    x -= i > k | j > l
             ? 0
             : ((k - i) % 2 == 0 && (l - j) % 2 == 0 && (i + j & 1) == 1) +
                   (k - i + 1) * (l - j + 1) / 2;
    printf("%lld %lld\n", n * m / 2 + n * m % 2 + x - y, n * m / 2 - x + y);
  }
}
