#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using pii = pair<int, int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
constexpr int inf = 0x3f3f3f3f;
constexpr ll mod = 1000000007;
inline ll powmod(ll a, ll b) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  bool debug = false;
  for (int(i) = (0); (i) < (t); ++(i)) {
    long long Y, X;
    cin >> Y >> X;
    long long a1, b1, c1, d1;
    long long a2, b2, c2, d2;
    cin >> a1 >> b1 >> c1 >> d1;
    cin >> a2 >> b2 >> c2 >> d2;
    long long x5 = max(a1, a2);
    long long y5 = max(b1, b2);
    long long x6 = min(c1, c2);
    long long y6 = min(d1, d2);
    long long tudo = X * Y;
    long long whiteTab = tudo / 2LL + (tudo & 1LL);
    long long blackTab = tudo / 2LL;
    if (x5 > x6 || y5 > y6) {
      long long wCol = (c1 - a1 + 1LL);
      long long wRow = (d1 - b1 + 1LL);
      long long wTudo = (wCol * wRow);
      long long wWhite = wTudo / 2LL;
      long long wBlack = wTudo / 2LL;
      if (wTudo & 1LL) {
        if ((a1 + b1) % 2LL == 0)
          wWhite++;
        else
          wBlack++;
      }
      long long bCol = (c2 - a2 + 1LL);
      long long bRow = (d2 - b2 + 1LL);
      long long bTudo = (bRow * bCol);
      long long bWhite = (bTudo / 2LL);
      long long bBlack = (bTudo / 2LL);
      if (bTudo & 1LL) {
        if ((a2 + b2) % 2LL == 0)
          bWhite++;
        else
          bBlack++;
      }
      blackTab -= wBlack;
      whiteTab -= bWhite;
      if (debug)
        cout << "wBlack = " << wBlack << " bWhite = " << bWhite << endl;
      cout << whiteTab + wBlack << " " << blackTab + bWhite << endl;
    } else {
      long long wCol = (c1 - a1 + 1LL);
      long long wRow = (d1 - b1 + 1LL);
      long long wTudo = (wCol * wRow);
      long long wWhite = wTudo / 2LL;
      long long wBlack = wTudo / 2LL;
      if (wTudo % 2LL == 1) {
        if ((a1 + b1) % 2LL == 0)
          wWhite++;
        else
          wBlack++;
      }
      if (debug)
        cout << "wWhite = " << wWhite << " wBlack = " << wBlack << endl;
      long long iCol = (x6 - x5 + 1LL);
      long long iRow = (y6 - y5 + 1LL);
      long long iTudo = (iCol * iRow);
      long long iWhite = iTudo / 2LL;
      long long iBlack = iTudo / 2LL;
      if (debug)
        cout << "intersec = ( " << x5 << "," << y5 << "," << x6 << "," << y6
             << endl;
      if (iTudo % 2LL == 1) {
        if ((x5 + y5) % 2LL == 0)
          iWhite++;
        else
          iBlack++;
      }
      if (debug)
        cout << "iWhite = " << iWhite << " iBlack = " << iBlack << endl;
      wWhite -= iWhite;
      wBlack -= iBlack;
      long long bCol = (c2 - a2 + 1LL);
      long long bRow = (d2 - b2 + 1LL);
      long long bTudo = (bRow * bCol);
      long long bWhite = (bTudo / 2LL);
      long long bBlack = (bTudo / 2LL);
      if (bTudo % 2LL == 1) {
        if ((a2 + b2) % 2LL == 0)
          bWhite++;
        else
          bBlack++;
      }
      blackTab -= wBlack;
      whiteTab -= bWhite;
      cout << whiteTab + wBlack << " " << blackTab + bWhite << endl;
    }
  }
  return 0;
}
