#include <bits/stdc++.h>
using namespace std;
long long blacks(long long x, long long y, bool mode) {
  long long ret = x * y;
  if (x % 2 == 0 || y % 2 == 0) {
    return ret / 2;
  }
  if (mode) return ret / 2;
  return ret / 2 + 1;
}
int main() {
  ios::sync_with_stdio(0);
  long long n, m;
  int t;
  cin >> t;
  for (int w = 0; w < t; w++) {
    cin >> n >> m;
    long long x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long ans = blacks(n, m, 1);
    ans -= blacks(x2 - x1 + 1, y2 - y1 + 1, bool((x1 + y1) % 2 == 0));
    ans += blacks(x4 - x3 + 1, y4 - y3 + 1, bool((x3 + y3) % 2 != 0));
    int x, xp, y, yp;
    x = max(x1, x3);
    xp = min(x2, x4);
    y = max(y1, y3);
    yp = min(y2, y4);
    int xx = xp - x + 1, yy = yp - y + 1;
    if (xx > 0 && yy > 0) {
      ans += blacks(xx, yy, bool((x + y) % 2 == 0));
    }
    cout << m * n - ans << " " << ans << endl;
  }
}
