#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    long long n, m;
    scanf("%lld %lld", &n, &m);
    long long tot = m * n;
    long long black = tot / 2LL;
    long long white = tot - black;
    long long x1, y1, x2, y2;
    scanf("%lld %lld", &x1, &y1);
    scanf("%lld %lld", &x2, &y2);
    long long tot_white = 1LL * (x2 - x1 + 1) * (y2 - y1 + 1);
    long long temp_w, temp_b;
    temp_b = temp_w = tot_white / 2LL;
    if (tot_white & 1LL) {
      if ((x1 + y1) & 1LL) {
        temp_b++;
      } else {
        temp_w++;
      }
    }
    white -= temp_w;
    black -= temp_b;
    long long x3, y3, x4, y4;
    scanf("%lld %lld", &x3, &y3);
    scanf("%lld %lld", &x4, &y4);
    long long tot_black = 1LL * abs(x4 - x3 + 1LL) * abs(y4 - y3 + 1LL);
    temp_b = temp_w = tot_black / 2LL;
    if (tot_black & 1LL) {
      if ((x3 + y3) & 1LL) {
        temp_b++;
      } else
        temp_w++;
    }
    white -= temp_w;
    black -= temp_b;
    long long x5 = max(x1, x3);
    long long y5 = max(y1, y3);
    long long x6 = min(x2, x4);
    long long y6 = min(y2, y4);
    function<bool(int x, int y)> check = [&](int x, int y) {
      return x >= x1 && x <= x2 && x >= x3 && x <= x4 && y >= y1 && y <= y2 &&
             y >= y3 && y <= y4;
    };
    if (check(x5, y5) && check(x6, y6)) {
      long long sob = 1LL * abs(x6 - x5 + 1LL) * abs(y6 - y5 + 1LL);
      temp_b = temp_w = sob / 2LL;
      if (sob & 1LL) {
        if ((x5 + y5) & 1LL)
          temp_b++;
        else
          temp_w++;
      }
      white += temp_w;
      black += temp_b;
      white -= sob;
    }
    white += tot_white;
    black += tot_black;
    printf("%lld %lld\n", white, black);
  }
  return 0;
}
