#include <bits/stdc++.h>
using namespace std;
int t;
long long n, m;
long long x[5], y[5];
pair<long long, long long> ans[1001];
long long cw(long long h, long long w, int i) {
  if (h % 2 == 0) return h * w / (long long)2;
  if (i == 0) return (h - 1) * w / (long long)2 + (w - w / (long long)2);
  return (h - 1) * w / (long long)2 + w / (long long)2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long x1, y1, x2, y2;
  long long h, w, cnt;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    cin >> n >> m;
    for (int j = 1; j <= 4; j++) cin >> x[j] >> y[j];
    ans[i].first = cw(n, m, 0);
    ans[i].second = n * m - ans[i].first;
    h = y[2] - y[1] + 1;
    w = x[2] - x[1] + 1;
    cnt = w * h - cw(h, w, (x[1] + y[1]) % 2);
    ans[i].first = ans[i].first + cnt;
    ans[i].second = ans[i].second - cnt;
    h = y[4] - y[3] + 1;
    w = x[4] - x[3] + 1;
    cnt = cw(h, w, (x[3] + y[3]) % 2);
    ans[i].first = ans[i].first - cnt;
    ans[i].second = ans[i].second + cnt;
    x1 = max(x[1], x[3]), y1 = max(y[1], y[3]), x2 = min(x[2], x[4]),
    y2 = min(y[2], y[4]);
    if (x1 <= x2 && y1 <= y2) {
      h = y2 - y1 + 1;
      w = x2 - x1 + 1;
      cnt = h * w - cw(h, w, (x1 + y1) % 2);
      ans[i].second += cnt;
      ans[i].first -= cnt;
    }
  }
  for (int i = 1; i <= t; i++)
    cout << ans[i].first << " " << ans[i].second << endl;
}
