#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INT_INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const int POS[8] = {0, 1, 0, -1, 1, 0, 1, -1};
const int MAXM = 1000005;
const int MAXN = 100005;
const int W = 0;
const int B = 1;
long long count(int x1, int y1, int x2, int y2, int color) {
  if (x1 > x2 || y1 > y2) return 0;
  long long ans = (long long)(x2 - x1 + 1) * (y2 - y1 + 1);
  if ((x1 + y1) % 2 == color) ans++;
  return ans / 2;
}
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    int X, Y, x1, y1, x2, y2, x3, y3, x4, y4;
    scanf("%d%d%d%d%d%d%d%d%d%d", &Y, &X, &x1, &y1, &x2, &y2, &x3, &y3, &x4,
          &y4);
    long long w = count(1, 1, X, Y, W) + count(x1, y1, x2, y2, B) -
                  count(x3, y3, x4, y4, W) -
                  count(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4), B);
    printf("%lld %lld\n", w, (long long)X * Y - w);
  }
  return 0;
}
