#include <bits/stdc++.h>
using namespace std;
const int L = 1 << 15;
char buf[L], *S, *T;
inline char gc() {
  if (S == T) {
    T = (S = buf) + fread(buf, 1, L, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
inline int read() {
  char c;
  register int x = 0, f = 1;
  for (c = gc(); !isdigit(c); c = gc())
    if (c == '-') f = -1;
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = gc();
  return x * f;
}
int n, m;
long long a, b;
vector<long long> vx, vy;
long long get(long long a1, long long b1, long long a2, long long b2) {
  long long s = (a2 - a1 + 1) * (b2 - b1 + 1) / 2;
  if (!((a1 + b1) & 1)) return (a2 - a1 + 1) * (b2 - b1 + 1) - s;
  return s;
}
long long get2(long long a1, long long b1, long long a2, long long b2) {
  long long s = (a2 - a1 + 1) * (b2 - b1 + 1) / 2;
  if (!((a1 + b1) & 1)) return s;
  return (a2 - a1 + 1) * (b2 - b1 + 1) - s;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int T;
  cin >> T;
  long long a1, b1, a2, b2, c1, d1, c2, d2;
  while (T--) {
    cin >> n >> m;
    a = get(1, 1, n, m), b = get2(1, 1, n, m);
    cin >> a1 >> b1 >> a2 >> b2;
    cin >> c1 >> d1 >> c2 >> d2;
    vx.push_back(a1);
    vy.push_back(b1);
    vx.push_back(a2);
    vy.push_back(b2);
    vx.push_back(c1);
    vy.push_back(d1);
    vx.push_back(c2);
    vy.push_back(d2);
    sort(vx.begin(), vx.end());
    sort(vy.begin(), vy.end());
    long long p;
    p = get2(a1, b1, a2, b2);
    b -= p, a += p;
    p = get(c1, d1, c2, d2);
    b += p, a -= p;
    long long minx, miny, maxx, maxy;
    minx = max(a1, c1);
    miny = max(b1, d1);
    maxx = min(a2, c2);
    maxy = min(b2, d2);
    if (minx <= maxx && miny <= maxy) {
      p = get2(minx, miny, maxx, maxy);
      a -= p, b += p;
    }
    cout << a << ' ' << b << endl;
  }
  return 0;
}
