#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
long long n, m, q;
int main() {
  int T;
  cin >> T;
  long long b, w;
  long long wx1, wx2, wy1, wy2, bx1, bx2, by1, by2;
  long long wh, ww, bh, bw;
  while (T--) {
    scanf("%lld%lld", &n, &m);
    b = n * m / 2LL;
    w = n * m - b;
    scanf("%lld%lld%lld%lld", &wx1, &wy1, &wx2, &wy2);
    scanf("%lld%lld%lld%lld", &bx1, &by1, &bx2, &by2);
    wh = wy2 - wy1 + 1LL;
    ww = wx2 - wx1 + 1LL;
    bh = by2 - by1 + 1LL;
    bw = bx2 - bx1 + 1LL;
    long long ox1, ox2, oy1, oy2;
    ox1 = max(wx1, bx1);
    oy1 = max(wy1, by1);
    ox2 = min(bx2, wx2);
    oy2 = min(wy2, by2);
    if (ox1 <= ox2 && oy1 <= oy2) {
      long long ws = wh * ww;
      b -= ws / 2LL;
      w += ws / 2LL;
      if (ws % 2LL && (wx1 + wy1) % 2LL) {
        b--;
        w++;
      }
      long long os = (ox2 - ox1 + 1LL) * (oy2 - oy1 + 1LL);
      b += os / 2LL;
      w -= os / 2LL;
      if (os % 2LL && (ox1 + oy1) % 2LL) {
        b++;
        w--;
      }
      long long bs = bh * bw;
      b += bs / 2LL;
      w -= bs / 2LL;
      if (bs % 2LL && (bx1 + by1) % 2LL == 0LL) {
        b++;
        w--;
      }
    } else {
      long long ws = wh * ww;
      b -= ws / 2LL;
      w += ws / 2LL;
      if (ws % 2LL && (wx1 + wy1) % 2LL) {
        b--;
        w++;
      }
      long long bs = bh * bw;
      b += bs / 2LL;
      w -= bs / 2LL;
      if (bs % 2LL && (bx1 + by1) % 2LL == 0LL) {
        b++;
        w--;
      }
    }
    printf("%lld %lld\n", w, b);
  }
}
