#include <bits/stdc++.h>
using namespace std;
const int Maxn = 10e9;
long long fwhite(long long x1, long long y1, long long x2, long long y2) {
  long long ans = ((x2 - x1 + 1) / 2) * ((y2 - y1 + 1) / 2) * 2;
  if ((x2 - x1) % 2 == 0) ans += (y2 - y1 + 1) / 2;
  if ((y2 - y1) % 2 == 0) ans += (x2 - x1 + 1) / 2;
  if ((x2 - x1) % 2 == 0 && (y2 - y1) % 2 == 0 && (x2 + y2) % 2 == 0) ans++;
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  long long t, n, m, x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long white = fwhite(1, 1, n, m);
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long a = (x2 - x1 + 1) * (y2 - y1 + 1),
              b = (x4 - x3 + 1) * (y4 - y3 + 1);
    white += a - fwhite(x1, y1, x2, y2) - fwhite(x3, y3, x4, y4);
    if (!(max(x1, x3) > min(x2, x4) || max(y1, y3) > min(y2, y4))) {
      long long x5 = max(x1, x3), x6 = min(x2, x4), y5 = max(y1, y3),
                y6 = min(y2, y4);
      white -= (x6 - x5 + 1) * (y6 - y5 + 1) - fwhite(x5, y5, x6, y6);
    }
    cout << white << ' ' << n * m - white << endl;
  }
  return 0;
}
