#include <bits/stdc++.h>
using namespace std;
const long long M = 1e5 + 7;
long long pre[M];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long tt = 1;
  cin >> tt;
  while (tt--) {
    long long n, m;
    cin >> n >> m;
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    x1--, y1--, x3--, y3--;
    long long x5, y5, x6, y6;
    x5 = max(x1, x3);
    y5 = max(y1, y3);
    x6 = min(x2, x4);
    y6 = min(y2, y4);
    long long b = (n * m) / 2, w = n * m - b;
    n = y2 - y1;
    m = x2 - x1;
    if ((x1 + y1) % 2 == 0) {
      b -= (n * m) / 2;
      w -= (n * m) - (n * m) / 2;
    } else {
      w -= (n * m) / 2;
      b -= (n * m) - (n * m) / 2;
    }
    w += n * m;
    n = y4 - y3, m = x4 - x3;
    long long b1, w1;
    if ((x3 + y3) % 2 == 0) {
      b1 = (n * m) / 2;
      w1 = (n * m) - (n * m) / 2;
    } else {
      w1 = (n * m) / 2;
      b1 = (n * m) - (n * m) / 2;
    }
    if (x5 < x6 && y5 < y6) {
      n = y6 - y5, m = x6 - x5;
      if ((x5 + y5) % 2 == 0) {
        b1 -= (n * m) / 2;
        w1 -= (n * m) - (n * m) / 2;
      } else {
        w1 -= (n * m) / 2;
        b1 -= (n * m) - (n * m) / 2;
      }
      w1 += n * m;
    }
    b -= b1;
    w -= w1;
    b += (y4 - y3) * (x4 - x3);
    cout << w << " " << b << "\n";
  }
  return 0;
}
