#include <bits/stdc++.h>
using namespace std;
long long int min(long long int x, long long int y) {
  if (x < y) return x;
  return y;
}
long long int max(long long int x, long long int y) {
  if (x > y) return x;
  return y;
}
long long int maxx(long long int x, long long int y, long long int z) {
  return max(x, max(y, z));
}
long long int isset(long long int n, long long int k) {
  if ((n >> (k)) & 1) return 1;
  return 0;
}
void yes() { cout << "Yes\n"; }
void no() { cout << "No\n"; }
vector<bool> prime(2e6, true);
void sieve(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (prime[i]) {
      for (long long int j = i * i; j <= n; j += i) prime[j] = false;
    }
  }
}
pair<long long int, long long int> cnt(long long int x1, long long int y1,
                                       long long int x2, long long int y2) {
  long long int ox = (x2 - x1) / 2;
  if (x2 % 2 != 0 || x1 % 2 != 0) ox += 1;
  long long int ex = (x2 - x1 + 1) - ox;
  long long int oy = (y2 - y1) / 2;
  if (y2 % 2 != 0 || y1 % 2 != 0) oy += 1;
  long long int ey = (y2 - y1 + 1) - oy;
  return {ex * ey + ox * oy, ex * oy + ox * ey};
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int wx1, wy1, wx2, wy2;
    long long int bx1, by1, bx2, by2;
    cin >> wx1 >> wy1 >> wx2 >> wy2 >> bx1 >> by1 >> bx2 >> by2;
    long long int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
    if (bx1 > wx2 or wx1 > bx2) {
    } else {
      x1 = max(wx1, bx1);
      x2 = min(wx2, bx2);
    }
    if (by1 > wy2 or wy1 > by2) {
    } else {
      y1 = max(wy1, by1);
      y2 = min(wy2, by2);
    }
    bool f = 0;
    if (x1 == -1 or x2 == -1 or y1 == -1 or y2 == -1) f = 1;
    auto ttl = cnt(1, 1, m, n);
    auto wh = cnt(wx1, wy1, wx2, wy2);
    auto bl = cnt(bx1, by1, bx2, by2);
    pair<long long int, long long int> it;
    if (!f) it = cnt(x1, y1, x2, y2);
    pair<long long int, long long int> ans;
    ans.first = {ttl.first + wh.second - bl.first - it.second};
    ans.second = {ttl.second - wh.second + bl.first + it.second};
    cout << ans.first << ' ' << ans.second << '\n';
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
