#include <bits/stdc++.h>
using namespace std;
long long int n, m, x1, x2, x3, x4, y11, y2, y3, y4;
long long int w = 0, b = 0;
long long int first(long long int x, long long int y) {
  long long int w1;
  w1 = (x * y) - (x * y) / 2;
  return w1;
}
long long int W(long long int a, long long int b, long long int c,
                long long int d) {
  return (first(c, d) - first(a - 1, d) - first(c, b - 1) +
          first(a - 1, b - 1));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    cin >> n >> m >> x1 >> y11 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    w = 0, b = 0;
    w += first(n, m), b += n * m - w;
    long long int p = W(x1, y11, x2, y2);
    long long int a1 = (x2 - x1 + 1) * (y2 - y11 + 1);
    w += a1 - p;
    b -= a1 - p;
    p = W(x3, y3, x4, y4);
    a1 = (x4 - x3 + 1) * (y4 - y3 + 1);
    w -= p;
    b += p;
    long long int c1 = max(x1, x3), c2 = max(y11, y3), c3 = min(x2, x4),
                  c4 = min(y2, y4);
    if (!(c1 > c3 || c2 > c4)) {
      p = W(c1, c2, c3, c4);
      a1 = (c3 - c1 + 1) * (c4 - c2 + 1);
      p = a1 - p;
      b += p;
      w -= p;
    }
    cout << w << ' ' << b << '\n';
  }
}
