#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 60;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
vector<int> vec[maxn];
int a[maxn];
int dp[maxn];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long n, m;
    scanf("%lld %lld", &n, &m);
    long long white = 0, black = 0;
    black = (n * m) / 2;
    long long x1, y1, x2, y2, x3, y3, x4, y4;
    scanf("%lld %lld %lld %lld", &x1, &y1, &x2, &y2);
    scanf("%lld %lld %lld %lld", &x3, &y3, &x4, &y4);
    if ((y2 - y1 + 1) * (x2 - x1 + 1) % 2 == 1 && (x1 + y1) % 2 == 1)
      black -= (y2 - y1 + 1) * (x2 - x1 + 1) / 2 + 1;
    else
      black -= (y2 - y1 + 1) * (x2 - x1 + 1) / 2;
    if ((y4 - y3 + 1) * (x4 - x3 + 1) % 2 == 1 && (x3 + y3) % 2 == 0)
      black += (y4 - y3 + 1) * (x4 - x3 + 1) / 2 + 1;
    else
      black += (y4 - y3 + 1) * (x4 - x3 + 1) / 2;
    if (x1 > x4 || x2 < x3 || y1 > y4 || y2 < y3)
      ;
    else {
      int tx1, ty1, ty2, tx2;
      tx1 = max(x1, x3);
      ty1 = max(y1, y3);
      tx2 = min(x2, x4);
      ty2 = min(y2, y4);
      if (1LL * (tx2 - tx1 + 1) * (ty2 - ty1 + 1) % 2 == 1 &&
          (tx1 + ty1) % 2 == 1)
        black += 1LL * (tx2 - tx1 + 1) * (ty2 - ty1 + 1) / 2 + 1;
      else
        black += 1LL * (tx2 - tx1 + 1) * (ty2 - ty1 + 1) / 2;
    }
    printf("%lld %lld\n", n * m - black, black);
  }
  return 0;
}
