#include <bits/stdc++.h>
using namespace std;
long long p[2];
void rect(long long a, long long b, long long c, long long d, long long co) {
  long long x = abs(b - a) % 2;
  p[0] -= ((c - a + 1) * (d - b + 1)) / 2;
  p[1] -= ((c - a + 1) * (d - b + 1)) / 2;
  if (((c - a + 1) * (d - b + 1)) % 2) {
    p[x]--;
  }
  p[co] += ((c - a + 1) * (d - b + 1));
}
void rect1(long long a, long long b, long long c, long long d) {
  long long x = abs(b - a) % 2;
  p[0] += ((c - a + 1) * (d - b + 1)) / 2;
  p[1] += ((c - a + 1) * (d - b + 1)) / 2;
  if (((c - a + 1) * (d - b + 1)) % 2) {
    p[x]++;
  }
  p[0] -= ((c - a + 1) * (d - b + 1));
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long long x3, y3, x4, y4;
  cin >> x3 >> y3 >> x4 >> y4;
  long long a, b, c, d;
  a = max(x1, x3);
  b = max(y1, y3);
  c = min(x2, x4);
  d = min(y2, y4);
  p[0] = p[1] = (n * m) / 2;
  if ((n * m) % 2) p[0]++;
  rect(x1, y1, x2, y2, 0);
  rect(x3, y3, x4, y4, 1);
  if (c >= a && d >= b) rect1(a, b, c, d);
  cout << p[0] << " " << p[1] << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  cin >> TESTS;
  while (TESTS--) {
    solve();
  }
  return 0;
}
