#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 1e9 + 7;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
long long B, W;
void matrix(long long x1, long long y1, long long x2, long long y2,
            long long ck) {
  long long tb, tw, total = (x2 - x1 + 1) * (y2 - y1 + 1);
  tb = total / 2, tw = total / 2;
  if ((x1 + y1) % 2 == 1 && total % 2 == 1) {
    tb++;
  }
  if ((x1 + y1) % 2 == 0 && total % 2 == 1) {
    tw++;
  }
  if (ck == 1) {
    B += tb, W += tw;
  } else {
    B -= tb, W -= tw;
  }
}
int main() {
  long long t, n, m, x1, y1, x2, y2, x3, y3, x4, y4;
  scanf("%I64d", &t);
  for (int i = 1; i <= t; i++) {
    scanf("%I64d %I64d", &n, &m);
    B = 0, W = 0;
    scanf("%I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d", &x1, &y1, &x2, &y2,
          &x3, &y3, &x4, &y4);
    matrix(1, 1, n, m, 1);
    matrix(x1, y1, x2, y2, 0);
    matrix(x3, y3, x4, y4, 0);
    long long mx1 = max(x1, x3), mx2 = max(y1, y3), mn1 = min(x2, x4),
              mn2 = min(y2, y4);
    long long tw = (y2 - y1 + 1) * (x2 - x1 + 1);
    long long tb = (x4 - x3 + 1) * (y4 - y3 + 1);
    W += tw;
    B += tb;
    if (mx1 >= x1 && mx1 <= x2 && mx2 >= y1 && mx2 <= y2 && mx1 >= x3 &&
        mx1 <= x4 && mx2 >= y3 && mx2 <= y4) {
      matrix(mx1, mx2, mn1, mn2, 1);
      W -= (abs(mn1 - mx1 + 1) * abs(mn2 - mx2 + 1));
    }
    printf("%I64d %I64d\n", W, B);
  }
  return 0;
}
