#include <bits/stdc++.h>
using namespace std;
int q, n, m, u1, d1, l1, r1, u2, d2, l2, r2, u3, d3, l3, r3;
long long count(int a, int b) { return (1ll * a * b + 1) / 2; }
long long count(int u, int d, int l, int r) {
  return count(d, r) + count(u - 1, l - 1) - count(d, l - 1) - count(u - 1, r);
}
int main() {
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d", &m, &n);
    scanf("%d %d %d %d", &u1, &l1, &d1, &r1);
    scanf("%d %d %d %d", &u2, &l2, &d2, &r2);
    long long ans = count(n, m);
    u3 = max(u1, u2), l3 = max(l1, l2);
    d3 = min(d1, d2), r3 = min(r1, r2);
    ans -= count(u2, d2, l2, r2);
    ans += 1ll * (d1 - u1 + 1) * (r1 - l1 + 1) - count(u1, d1, l1, r1);
    if (d3 >= u3 && r3 >= l3)
      ans -= 1ll * (d3 - u3 + 1) * (r3 - l3 + 1) - count(u3, d3, l3, r3);
    printf("%I64d %I64d\n", ans, 1ll * n * m - ans);
  }
  return 0;
}
