#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::max;
using std::min;
long long W(long long x1, long long y1, long long x2, long long y2, bool v) {
  long long ans = 0;
  if (((x2 - x1 + 1) & 1) == 0 || ((y2 - y1 + 1) & 1) == 0 || ((x1 + y1) & 1))
    ans = (x2 - x1 + 1) * (y2 - y1 + 1) / 2;
  else
    ans = (x2 - x1 + 1) * (y2 - y1 + 1) / 2 + 1;
  if (v) return (x2 - x1 + 1) * (y2 - y1 + 1) - ans;
  return ans;
}
int main() {
  int t;
  long long n, m;
  long long x1, x2, y1, y2, x3, x4, y3, y4;
  long long w = 0;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (((n & 1) == 0) || (m & 1) == 0)
      w = n * m / 2;
    else
      w = n * m / 2 + 1;
    w = w + W(x1, y1, x2, y2, 1) - W(x3, y3, x4, y4, 0);
    if ((max(x1, x3) <= min(x2, x4)) && (max(y1, y3) <= min(y2, y4)))
      w -= W(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4), 1);
    cout << w << ' ' << n * m - w << endl;
  }
  return 0;
}
