#include <bits/stdc++.h>
using namespace std;
long long k(int x, int y) {
  if ((x & 1) && (y & 1)) {
    return (1LL * x * y) / 2 + 1;
  } else {
    return (1LL * x * y) / 2;
  }
}
long long kwhite(int x1, int y1, int x2, int y2) {
  long long ans =
      (1LL * k(x2, y2) - k(x1 - 1, y2) - k(x2, y1 - 1) + k(x1 - 1, y1 - 1));
  return ans;
}
long long kblack(int x1, int y1, int x2, int y2) {
  long long ans = 1LL * (y2 - y1 + 1) * (x2 - x1 + 1) - kwhite(x1, y1, x2, y2);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long long n, m;
    cin >> n >> m;
    long long x1, x2, y1, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long b = kblack(1, 1, m, n) - kblack(x1, y1, x2, y2);
    long long w = kwhite(1, 1, m, n) - kwhite(x1, y1, x2, y2) +
                  (x2 - x1 + 1) * (y2 - y1 + 1);
    if (!(x2 < x3 || x4 < x1 || y2 < y3 || y4 < y1)) {
      long long sx = max(x1, x3), sy = max(y1, y3), fx = min(x2, x4),
                fy = min(y2, y4);
      w -= (fx - sx + 1) * (fy - sy + 1);
      b += kblack(sx, sy, fx, fy);
      w += kwhite(sx, sy, fx, fy);
    }
    b -= kblack(x3, y3, x4, y4);
    w -= kwhite(x3, y3, x4, y4);
    b += (x4 - x3 + 1) * (y4 - y3 + 1);
    cout << w << " " << b << "\n";
  }
  return 0;
}
