#include <bits/stdc++.h>
using namespace std;
long long w, b;
void fun(long long a, long long b1) {
  w = ceil(a / 2.0) * ceil(b1 / 2.0);
  b = (a - ceil(a / 2.0)) * ceil(b1 / 2.0);
  b += ceil(a / 2.0) * ceil((b1 - 1) / 2.0);
  w += (a - ceil(a / 2.0)) * ceil((b1 - 1) / 2.0);
}
int main() {
  long long ans1, ans2;
  long long t, n, m, x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    fun(m, n);
    ans1 = w;
    ans2 = b;
    if (x1 % 2 == y1 % 2) {
      fun(abs(x2 - x1 + 1), abs(y2 - y1 + 1));
      ans1 += b;
      ans2 -= b;
    } else {
      fun(abs(x2 - x1 + 1), abs(y2 - y1 + 1));
      ans1 += w;
      ans2 -= w;
    }
    if (x3 % 2 == y3 % 2) {
      fun(abs(x4 - x3 + 1), abs(y4 - y3 + 1));
      ans1 -= w;
      ans2 += w;
    } else {
      fun(abs(x4 - x3 + 1), abs(y4 - y3 + 1));
      ans1 -= b;
      ans2 += b;
    }
    long long xa, xb, ya, yb;
    xa = max(min(x1, x2), min(x3, x4)), xb = min(max(x1, x2), max(x3, x4));
    ya = max(min(y1, y2), min(y3, y4)), yb = min(max(y1, y2), max(y3, y4));
    if (xb >= xa && yb >= ya) {
      fun(xb - xa + 1, yb - ya + 1);
      if (xa % 2 == ya % 2) {
        ans1 -= b;
        ans2 += b;
      } else {
        ans1 -= w;
        ans2 += w;
      }
    }
    cout << ans1 << " " << ans2 << "\n";
  }
  return 0;
}
