#include <bits/stdc++.h>
using namespace std;
int t, n, m;
int a, b, c, d;
int e, f, g, h;
long long ans1, ans2, t1, t2, t3;
long long spill(int xs, int ys, int xe, int ye, int c) {
  if (xe < xs || ye < ys) return 0;
  int p = ((xs & 1) == (ys & 1)), q = ((xe & 1) == (ye & 1));
  if ((xe - xs + 1) % 2 == 0 || (ye - ys + 1) % 2 == 0)
    return 1ll * (xe - xs + 1) * (ye - ys + 1) / 2;
  if (p != q)
    return 1ll * (xe - xs + 1) * (ye - ys + 1) / 2;
  else if (p == c)
    return (1ll * (xe - xs + 1) * (ye - ys + 1) - 1) / 2;
  else
    return (1ll * (xe - xs + 1) * (ye - ys + 1) + 1) / 2;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &m, &n);
    scanf("%d%d%d%d", &a, &b, &c, &d);
    scanf("%d%d%d%d", &e, &f, &g, &h);
    ans1 = spill(1, 1, n, m, 0);
    ans2 = spill(1, 1, n, m, 1);
    t1 = spill(a, b, c, d, 1);
    t2 = spill(e, f, g, h, 0);
    t3 = spill(max(a, e), max(b, f), min(c, g), min(d, h), 1);
    printf("%I64d %I64d\n", ans1 + t1 - t2 - t3, ans2 - t1 + t2 + t3);
  }
}
