#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 1e9;
const int maxn = 300;
long long n, m, k;
long long white(long long x1, long long y1, long long x2, long long y2) {
  return ((x2 - x1 + 1) * (y2 - y1 + 1) + (abs(x1 - y1) % 2 == 0)) / 2;
}
long long black(long long x1, long long y1, long long x2, long long y2) {
  if (x1 > x2 || y1 > y2) return 0;
  return (x2 - x1 + 1) * (y2 - y1 + 1) - white(x1, y1, x2, y2);
}
int main() {
  long long ans = 0;
  int q;
  scanf("%d", &q);
  while (q--) {
    long long x1, x2, y1, y2;
    long long x3, y3, x4, y4;
    scanf("%lld%lld", &n, &m);
    scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);
    scanf("%lld%lld%lld%lld", &x3, &y3, &x4, &y4);
    long long ans = 0;
    ans = white(1, 1, n, m);
    ans += black(x1, y1, x2, y2);
    ans -= white(x3, y3, x4, y4);
    ans -= black(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
    printf("%lld %lld\n", ans, n * m - ans);
  }
  return 0;
}
