#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  for (long long k1 = 0; k1 < t; k1++) {
    long long n, m;
    cin >> n >> m;
    long long pro = n * m;
    long long cntb, cntw;
    cntb = pro / 2;
    cntw = pro / 2;
    if (pro % 2 != 0) {
      cntw++;
    }
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long d1 = x2 - x1 + 1;
    long long d2 = y2 - y1 + 1;
    long long pro1 = d1 * d2;
    long long cnb, cnw;
    cnb = pro1 / 2;
    cnw = pro1 / 2;
    if (pro1 % 2 != 0) {
      if ((x1 + y1) % 2 == 0)
        cnw++;
      else {
        cnb++;
      }
    }
    cntb -= cnb;
    cntw += cnb;
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    d1 = x4 - x3 + 1;
    d2 = y4 - y3 + 1;
    pro1 = d1 * d2;
    cnb = pro1 / 2;
    cnw = pro1 / 2;
    if (pro1 % 2 != 0) {
      if ((x3 + y3) % 2 == 0)
        cnw++;
      else {
        cnb++;
      }
    }
    cntw -= cnw;
    cntb += cnw;
    long long x5, y5, x6, y6;
    x5 = max(x1, x3);
    y5 = max(y1, y3);
    x6 = min(x2, x4);
    y6 = min(y2, y4);
    if (x5 <= x6 && y5 <= y6) {
      d1 = x6 - x5 + 1;
      d2 = y6 - y5 + 1;
      pro1 = d1 * d2;
      cnb = pro1 / 2;
      cnw = pro1 / 2;
      if (pro1 % 2 != 0) {
        if ((x5 + y5) % 2 == 0)
          cnw++;
        else {
          cnb++;
        }
      }
      cntw -= cnb;
      cntb += cnb;
    }
    cout << cntw << " " << cntb << endl;
  }
  return 0;
}
