#include <bits/stdc++.h>
using namespace std;
long long getW(long long x1, long long y1, long long x2, long long y2) {
  long long s = (x2 - x1 + 1) * (y2 - y1 + 1);
  if (s % 2 == 0) return s / 2;
  if ((x1 + y1) % 2 == 0) return s / 2 + 1;
  return s / 2;
}
long long getB(long long x1, long long y1, long long x2, long long y2) {
  long long s = (x2 - x1 + 1) * (y2 - y1 + 1);
  if (s % 2 == 0) return s / 2;
  if ((x1 + y1) % 2 == 0) return s / 2;
  return s / 2 + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k;
  cin >> k;
  while (k--) {
    int n, m;
    cin >> n >> m;
    vector<long long> X(4);
    vector<long long> Y(4);
    cin >> X[0] >> Y[0] >> X[1] >> Y[1];
    cin >> X[2] >> Y[2] >> X[3] >> Y[3];
    long long w = getW(1, 1, m, n);
    long long b = getB(1, 1, m, n);
    long long fs = getB(X[0], Y[0], X[1], Y[1]);
    w += fs;
    b -= fs;
    long long ss = getW(X[2], Y[2], X[3], Y[3]);
    w -= ss;
    b += ss;
    if (X[0] > X[3] || X[2] > X[1] || Y[3] < Y[0] || Y[1] < Y[2]) {
    } else {
      sort(X.begin(), X.end());
      sort(Y.begin(), Y.end());
      long long kek = getB(X[1], Y[1], X[2], Y[2]);
      w -= kek;
      b += kek;
    }
    cout << w << " " << b << " "
         << "\n";
  }
  return 0;
}
