#include <bits/stdc++.h>
long long int max(long long int a, long long int b) { return a > b ? a : b; }
long long int min(long long int a, long long int b) { return a < b ? a : b; }
long long int cnt(long long int x, long long int y) {
  long long int w;
  w = x * y / 2;
  if ((x * y) % 2 != 0) w++;
  return w;
}
long long int cntWhite(long long int x1, long long int y1, long long int x2,
                       long long int y2) {
  long long int w;
  w = cnt(x2, y2) - cnt(x1 - 1, y2) - cnt(x2, y1 - 1) + cnt(x1 - 1, y1 - 1);
  return w;
}
long long int cntBlack(long long int x1, long long int y1, long long int x2,
                       long long int y2) {
  long long int b;
  b = (x2 - x1 + 1) * (y2 - y1 + 1) - cntWhite(x1, y1, x2, y2);
  return b;
}
int main(void) {
  int t, n, m;
  long long int x1, y1, x2, y2, w, b;
  long long int x3, y3, x4, y4;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    scanf("%d %d", &n, &m);
    scanf("%lld %lld %lld %lld", &x1, &y1, &x2, &y2);
    scanf("%lld %lld %lld %lld", &x3, &y3, &x4, &y4);
    w = cntWhite(1, 1, m, n);
    b = cntBlack(1, 1, m, n);
    w += cntBlack(x1, y1, x2, y2);
    b -= cntBlack(x1, y1, x2, y2);
    w -= cntWhite(x3, y3, x4, y4);
    b += cntWhite(x3, y3, x4, y4);
    if (!((max(x1, x3) > min(x2, x4)) || (max(y1, y3) > min(y2, y4)))) {
      w -= cntBlack(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
      b += cntBlack(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
    }
    printf("%lld %lld\n", w, b);
  }
  return 0;
}
