#include <bits/stdc++.h>
using namespace std;
inline long long make(long long x, long long y) { return x * y / 2; }
inline long long ct(long long x1, long long y1, long long x2, long long y2) {
  if (x1 > x2 || y1 > y2) return 0LL;
  return (make(x2, y2) - make(x1 - 1, y2) - make(x2, y1 - 1) +
          make(x1 - 1, y1 - 1));
}
int main() {
  int t;
  long long n, m, x1, y1, x2, y2, x3, y3, x4, y4;
  scanf("%d", &t);
  while (t--) {
    cin >> n >> m >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long xx1 = max(x1, x3), yy1 = max(y1, y3), xx2 = min(x2, x4),
              yy2 = min(y2, y4);
    long long cnt = ct(1, 1, n, m) - ct(x1, y1, x2, y2) +
                    ct(xx1, yy1, xx2, yy2) - ct(x3, y3, x4, y4) +
                    (x4 - x3 + 1) * (y4 - y3 + 1);
    cout << n * m - cnt << ' ' << cnt << endl;
  }
  return 0;
}
