#include <bits/stdc++.h>
using namespace std;
long long calWhite(long long x1, long long y1, long long x2, long long y2) {
  if (x1 == 0 || y1 == 0 || x2 == 0 || y2 == 0) {
    return 0;
  }
  long long tmp = (abs(x1 - x2) + 1) * (abs(y1 - y2) + 1);
  long long res = tmp / 2;
  if (tmp % 2 == 1 && (x1 * y1 % 2 == 1 || (x1 % 2 == 0 && y1 % 2 == 0))) {
    res++;
  }
  return res;
}
long long calBlack(long long x1, long long y1, long long x2, long long y2) {
  if (x1 == 0 || y1 == 0 || x2 == 0 || y2 == 0) {
    return 0;
  }
  return (x2 - x1 + 1) * (y2 - y1 + 1) - calWhite(x1, y1, x2, y2);
}
int main() {
  long long t;
  scanf("%I64d", &t);
  while (t--) {
    long long n, m;
    long long x1, x2, y1, y2;
    long long x3, x4, y3, y4;
    scanf("%I64d%I64d", &n, &m);
    scanf("%I64d%I64d%I64d%I64d", &x1, &y1, &x2, &y2);
    scanf("%I64d%I64d%I64d%I64d", &x3, &y3, &x4, &y4);
    long long answ = calWhite(1, 1, n, m);
    answ += calBlack(x1, y1, x2, y2);
    answ -= calWhite(x3, y3, x4, y4);
    long long x5, y5, x6, y6;
    if (x1 <= x3 && x3 <= x2) {
      x5 = x3;
      x6 = min(x2, x4);
    } else if (x1 <= x4 && x4 <= x2) {
      x5 = max(x1, x3);
      x6 = x4;
    } else if (x3 <= x1 && x2 <= x4) {
      x5 = x1;
      x6 = x2;
    } else {
      x5 = x6 = 0;
    }
    if (y1 <= y3 && y3 <= y2) {
      y5 = y3;
      y6 = min(y2, y4);
    } else if (y1 <= y4 && y4 <= y2) {
      y5 = max(y1, y3);
      y6 = y4;
    } else if (y3 <= y1 && y2 <= y4) {
      y5 = y1;
      y6 = y2;
    } else {
      y5 = y6 = 0;
    }
    answ -= calBlack(x5, y5, x6, y6);
    printf("%I64d %I64d\n", answ, n * m - answ);
  }
}
