#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
void setmin(T& a, T val) {
  if (a > val) a = val;
}
template <class T>
void setmax(T& a, T val) {
  if (a < val) a = val;
}
void addmod(long long& a, long long val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
void submod(long long& a, long long val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
const int N = 100005;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long wtotal = n * m / 2, btotal = n * m / 2;
    if ((n * m) % 2) wtotal++;
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    long long k1 = abs(x2 - x1 + 1) * abs(y2 - y1 + 1),
              k2 = abs(x4 - x3 + 1) * abs(y4 - y3 + 1);
    long long black = k1 / 2;
    if ((x1 + y1) % 2 && k1 % 2) black++;
    wtotal += black;
    btotal -= black;
    long long white = k2 / 2;
    if ((x3 + y3) % 2 == 0 && k2 % 2) white++;
    btotal += white;
    wtotal -= white;
    long long x5 = max(x1, x3);
    long long y5 = max(y1, y3);
    long long x6 = min(x2, x4);
    long long y6 = min(y2, y4);
    if (y5 > y6 || x5 > x6)
      cout << wtotal << " " << btotal << "\n";
    else {
      long long bext = abs(x6 - x5 + 1) * abs(y6 - y5 + 1);
      long long b = bext / 2;
      if ((x5 + y5) % 2 && bext % 2) b++;
      cout << wtotal - b << " " << btotal + b << "\n";
    }
  }
  return 0;
}
