#include <bits/stdc++.h>
using namespace std;
struct XX {
  int s;
  vector<int> t;
};
class xxGreater {
 public:
  bool operator()(const XX& riLeft, const XX& riRight) const {
    return (riLeft.s) < (riRight.s);
  }
};
int main(int argc, const char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  long long n[1000];
  long long m[1000];
  long long wx1[1000];
  long long wy1[1000];
  long long wx2[1000];
  long long wy2[1000];
  long long bx1[1000];
  long long by1[1000];
  long long bx2[1000];
  long long by2[1000];
  for (int i = 0; i < t; i++) {
    cin >> n[i] >> m[i];
    cin >> wx1[i] >> wy1[i] >> wx2[i] >> wy2[i];
    cin >> bx1[i] >> by1[i] >> bx2[i] >> by2[i];
  }
  long long answ = 0;
  long long ansb = 0;
  for (int i = 0; i < t; i++) {
    if (n[i] % 2 == 1 && m[i] % 2 == 1) {
      ansb = (n[i] * m[i]) / 2;
      answ = (n[i] * m[i]) / 2 + 1;
    } else {
      ansb = (n[i] * m[i]) / 2;
      answ = (n[i] * m[i]) / 2;
    }
    long long wwx1, wwy1, wwx2, wwy2;
    wwx1 = max(wx1[i], bx1[i]);
    wwy1 = max(wy1[i], by1[i]);
    wwx2 = min(wx2[i], bx2[i]);
    wwy2 = min(wy2[i], by2[i]);
    long long kuro = 0;
    if (wwx1 <= wwx2 && wwy1 <= wwy2) {
      if ((wwx2 - (wwx1 - 1)) % 2 == 1 && (wwy2 - (wwy1 - 1)) % 2 == 1) {
        if ((wwx1 + wwy1) % 2 == 0) {
          kuro = ((wwx2 - (wwx1 - 1)) * (wwy2 - (wwy1 - 1))) / 2;
        } else {
          kuro = ((wwx2 - (wwx1 - 1)) * (wwy2 - (wwy1 - 1))) / 2 + 1;
        }
      } else {
        kuro = ((wwx2 - (wwx1 - 1)) * (wwy2 - (wwy1 - 1))) / 2;
      }
    }
    if ((wx2[i] - (wx1[i] - 1)) % 2 == 1 && (wy2[i] - (wy1[i] - 1)) % 2 == 1) {
      if ((wx1[i] + wy1[i]) % 2 == 0) {
        ansb -= ((wx2[i] - (wx1[i] - 1)) * (wy2[i] - (wy1[i] - 1))) / 2;
        answ += ((wx2[i] - (wx1[i] - 1)) * (wy2[i] - (wy1[i] - 1))) / 2;
      } else {
        ansb -= ((wx2[i] - (wx1[i] - 1)) * (wy2[i] - (wy1[i] - 1))) / 2 + 1;
        answ += ((wx2[i] - (wx1[i] - 1)) * (wy2[i] - (wy1[i] - 1))) / 2 + 1;
      }
    } else {
      ansb -= ((wx2[i] - (wx1[i] - 1)) * (wy2[i] - (wy1[i] - 1))) / 2;
      answ += ((wx2[i] - (wx1[i] - 1)) * (wy2[i] - (wy1[i] - 1))) / 2;
    }
    ansb += kuro;
    answ -= kuro;
    if ((bx2[i] - (bx1[i] - 1)) % 2 == 1 && (by2[i] - (by1[i] - 1)) % 2 == 1) {
      if ((bx1[i] + by1[i]) % 2 == 0) {
        ansb += ((bx2[i] - (bx1[i] - 1)) * (by2[i] - (by1[i] - 1))) / 2 + 1;
        answ -= ((bx2[i] - (bx1[i] - 1)) * (by2[i] - (by1[i] - 1))) / 2 + 1;
      } else {
        ansb += ((bx2[i] - (bx1[i] - 1)) * (by2[i] - (by1[i] - 1))) / 2;
        answ -= ((bx2[i] - (bx1[i] - 1)) * (by2[i] - (by1[i] - 1))) / 2;
      }
    } else {
      ansb += ((bx2[i] - (bx1[i] - 1)) * (by2[i] - (by1[i] - 1))) / 2;
      answ -= ((bx2[i] - (bx1[i] - 1)) * (by2[i] - (by1[i] - 1))) / 2;
    }
    cout << answ << " " << ansb << endl;
  }
  return 0;
}
