#include <bits/stdc++.h>
using namespace std;
struct Rec {
  long long x, y, x2, y2;
  Rec(){};
  Rec(long long x, long long y, long long x2, long long y2) {
    this->x = x;
    this->x2 = x2;
    this->y = y;
    this->y2 = y2;
  }
  Rec intersec(Rec B) {
    long long lx = max(this->x, B.x), ly = max(this->y, B.y),
              rx = min(this->x2, B.x2), ry = min(this->y2, B.y2);
    return Rec(lx, ly, rx, ry);
  }
  long long S() { return (this->y2 - this->y + 1) * (this->x2 - this->x + 1); }
};
long long calcBlack(Rec r) {
  long long lx = r.x, rx = r.x2, ly = r.y, ry = r.y2;
  long long tmp = r.S() / 2;
  if (r.S() % 2 == 0) return tmp;
  if ((lx + ly) % 2 == 1)
    return tmp + 1;
  else
    return tmp;
}
long long calcWhite(Rec r) { return r.S() - calcBlack(r); }
long long a[5], b[5];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long n, m;
    scanf("%lld%lld", &n, &m);
    for (int i = 0; i < 4; i++) {
      scanf("%lld", &a[i]);
    }
    for (int i = 0; i < 4; i++) {
      scanf("%lld", &b[i]);
    }
    Rec white = Rec(a[0], a[1], a[2], a[3]);
    Rec black = Rec(b[0], b[1], b[2], b[3]);
    Rec tot = Rec(1, 1, m, n);
    long long ans0 = calcWhite(tot), ans1 = calcBlack(tot);
    ans0 -= calcWhite(white);
    ans1 -= calcBlack(white);
    ans0 += white.S();
    Rec tmp = white.intersec(black);
    if (tmp.x <= tmp.x2 && tmp.y <= tmp.y2) {
      ans0 -= tmp.S();
      ans0 += calcWhite(tmp);
      ans1 += calcBlack(tmp);
    }
    ans0 -= calcWhite(black);
    ans1 -= calcBlack(black);
    ans1 += black.S();
    printf("%lld %lld\n", ans0, ans1);
  }
  return 0;
}
