#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << a;
  cout << '\n';
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << ' ';
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << ' ';
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << ' ';
  pr(b, c, d);
}
template <class A>
void PR(A a, long long n) {
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (i) cout << ' ';
    cout << a[i];
  }
  cout << '\n';
}
long long check(long long n, long long m, long long x, long long y) {
  return x >= 0 && x < n && y >= 0 && y < m;
}
const long long MAX = 1e9 + 7, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
                dy[4] = {0, 1, 0, -1};
long long calc(long long n, long long m) {
  long long d = n * m / 2;
  if (n % 2 && m % 2) d++;
  return d;
}
long long calc2(long long n, long long m) { return n * m - calc(n, m); }
void Main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n, m, x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long xx1 = max(x1, x3), yy1 = max(y1, y3), xx2 = min(x2, x4),
              yy2 = min(y2, y4);
    long long c = calc(n, m), d = calc2(n, m);
    long long z1 = calc2(x2, y2) - calc2(x2, y1 - 1) - calc2(x1 - 1, y2) +
                   calc2(x1 - 1, y1 - 1);
    d -= z1;
    c += z1;
    long long z2 = calc(x4, y4) - calc(x4, y3 - 1) - calc(x3 - 1, y4) +
                   calc(x3 - 1, y3 - 1);
    d += z2;
    c -= z2;
    if (xx1 <= xx2 && yy1 <= yy2) {
      long long z3 = calc2(xx2, yy2) - calc2(xx2, yy1 - 1) -
                     calc2(xx1 - 1, yy2) + calc2(xx1 - 1, yy1 - 1);
      d += z3;
      c -= z3;
    }
    pr(c, d);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Main();
  return 0;
}
