#include <bits/stdc++.h>
long long n, m;
long long q(long long n, long long m) { return (n * m) / 2; }
long long query(long long l1, long long r1, long long l2, long long r2) {
  if (l1 > r1 || l2 > r2) return 0;
  return q(r1, r2) - q(l1 - 1, r2) - q(r1, l2 - 1) + q(l1 - 1, l2 - 1);
}
void solve() {
  scanf("%lld%lld", &n, &m);
  long long sum = query(1, n, 1, m);
  long long l1, l2, l3, l4, r1, r2, r3, r4;
  scanf("%lld%lld%lld%lld", &l1, &l2, &r1, &r2);
  scanf("%lld%lld%lld%lld", &l3, &l4, &r3, &r4);
  sum -= query(l1, r1, l2, r2);
  sum -= query(l3, r3, l4, r4);
  sum += query(std::max(l1, l3), std::min(r1, r3), std::max(l2, l4),
               std::min(r2, r4));
  sum += (r3 - l3 + 1) * (r4 - l4 + 1);
  printf("%lld %lld\n", n * m - sum, sum);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
