#include <bits/stdc++.h>
using namespace std;
bool ktden(long long x, long long y) {
  if (((x % 2 == 0) && (y % 2 == 1)) || ((x % 2 == 1) && (y % 2 == 0)))
    return true;
  else
    return false;
}
int main() {
  long long T, i, n, m, Ax1, Ax2, Ay1, Ay2, Bx1, Bx2, By1, By2, Cx1, Cx2, Cy1,
      Cy2, den, trang, Ad, Ar, Bd, Br, Cd, Cr;
  bool kt;
  cin >> T;
  for (i = 1; i <= T; i++) {
    cin >> n >> m;
    den = 0;
    trang = 0;
    if ((n % 2) * (m % 2) == 0) {
      den = m * n / 2;
      trang = m * n / 2;
    } else {
      den = m * n / 2;
      trang = m * n / 2 + 1;
    }
    cin >> Ax1 >> Ay1 >> Ax2 >> Ay2;
    cin >> Bx1 >> By1 >> Bx2 >> By2;
    Ad = Ax2 - Ax1 + 1;
    Ar = Ay2 - Ay1 + 1;
    Bd = Bx2 - Bx1 + 1;
    Br = By2 - By1 + 1;
    if ((Ad * Ar) % 2 == 0)
      den -= (Ad * Ar / 2);
    else if (ktden(Ax1, Ay1) == true)
      den -= (Ad * Ar / 2) + 1;
    else
      den -= Ad * Ar / 2;
    kt = true;
    if (Ax1 > Bx2) kt = false;
    if (Ax2 < Bx1) kt = false;
    if (Ay1 > By2) kt = false;
    if (Ay2 < By1) kt = false;
    if (kt == false) {
      if (Bd * Br % 2 == 0)
        den += Bd * Br / 2;
      else if (ktden(Bx1, By1) == true)
        den += Bd * Br / 2;
      else
        den += Bd * Br / 2 + 1;
    }
    if (kt == true) {
      if (Bd * Br % 2 == 0)
        den += Bd * Br / 2;
      else if (ktden(Bx1, By1) == true)
        den += Bd * Br / 2;
      else
        den += Bd * Br / 2 + 1;
      Cx1 = max(Ax1, Bx1);
      Cy1 = max(Ay1, By1);
      Cx2 = min(Ax2, Bx2);
      Cy2 = min(Ay2, By2);
      Cd = Cx2 - Cx1 + 1;
      Cr = Cy2 - Cy1 + 1;
      if ((Cd * Cr) % 2 == 0)
        den += (Cd * Cr / 2);
      else if (ktden(Cx1, Cy1) == true)
        den += (Cd * Cr / 2) + 1;
      else
        den += Cd * Cr / 2;
    }
    cout << m * n - den << " " << den << endl;
  }
  return 0;
}
