#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
unsigned long long cal_w(unsigned long long lx, unsigned long long ly,
                         unsigned long long rx, unsigned long long ry) {
  if ((lx + ly) % 2 == (rx + ry) % 2) {
    if ((lx + ly) % 2 == 0)
      return ((rx - lx + 1) * (ry - ly + 1) + 1) / 2;
    else
      return (rx - lx + 1) * (ry - ly + 1) / 2;
  } else {
    return (rx - lx + 1) * (ry - ly + 1) / 2;
  }
}
unsigned long long cal_b(unsigned long long lx, unsigned long long ly,
                         unsigned long long rx, unsigned long long ry) {
  unsigned long long tot = (rx - lx + 1) * (ry - ly + 1);
  return tot - cal_w(lx, ly, rx, ry);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    unsigned long long n, m, x1, y1, x2, y2, x3, y3, x4, y4;
    unsigned long long white = 0, black = 0;
    scanf("%lld%lld", &n, &m);
    scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);
    scanf("%lld%lld%lld%lld", &x3, &y3, &x4, &y4);
    white = cal_w(1, 1, m, n);
    black = cal_b(1, 1, m, n);
    white += cal_b(x1, y1, x2, y2);
    black -= cal_b(x1, y1, x2, y2);
    white -= cal_w(x3, y3, x4, y4);
    black += cal_w(x3, y3, x4, y4);
    unsigned long long lx = max(x1, x3), ly = max(y1, y3), rx = min(x2, x4),
                       ry = min(y2, y4);
    if (lx <= rx && ly <= ry) {
      white -= cal_b(lx, ly, rx, ry);
      black += cal_b(lx, ly, rx, ry);
    }
    cout << white << ' ' << black << endl;
  }
  return 0;
}
