#include <bits/stdc++.h>
using namespace std;
pair<unsigned long long, unsigned long long> f(
    pair<unsigned long long, unsigned long long> a,
    pair<unsigned long long, unsigned long long> b) {
  pair<unsigned long long, unsigned long long> w;
  unsigned long long c = (b.first - a.first) * (b.second - a.second);
  w.first = c / 2;
  w.second = c / 2 + c % 2;
  if ((a.first + a.second) % 2) swap(w.first, w.second);
  return w;
}
unsigned long long max(unsigned long long a, unsigned long long b) {
  return (a > b) ? a : b;
}
unsigned long long min(unsigned long long a, unsigned long long b) {
  return (a < b) ? a : b;
}
bool doOverlap(pair<unsigned long long, unsigned long long> l1,
               pair<unsigned long long, unsigned long long> r1,
               pair<unsigned long long, unsigned long long> l2,
               pair<unsigned long long, unsigned long long> r2) {
  if (l1.first > r2.first || l2.first > r1.first) return false;
  if (l1.second < r2.second || l2.second < r1.second) return false;
  return true;
}
pair<pair<unsigned long long, unsigned long long>,
     pair<unsigned long long, unsigned long long> >
overlapPoint(pair<unsigned long long, unsigned long long> p1,
             pair<unsigned long long, unsigned long long> p2,
             pair<unsigned long long, unsigned long long> p3,
             pair<unsigned long long, unsigned long long> p4) {
  pair<unsigned long long, unsigned long long> p5, p6;
  if (doOverlap(make_pair(p1.first, p2.second), make_pair(p2.first, p1.second),
                make_pair(p3.first, p4.second),
                make_pair(p4.first, p3.second)) == false) {
    p5.first = 0;
    p5.second = 0;
    p6.first = 0;
    p6.second = 0;
  } else {
    p5.first = max(p1.first, p3.first);
    p5.second = max(p1.second, p3.second);
    p6.first = min(p2.first, p4.first);
    p6.second = min(p2.second, p4.second);
  }
  return make_pair(p5, p6);
}
int main() {
  pair<unsigned long long, unsigned long long> p1, p2, p3, p4, p5, p6;
  pair<unsigned long long, unsigned long long> w1, w2, w3;
  unsigned long long a, b;
  int t;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    pair<unsigned long long, unsigned long long> k =
        f(make_pair(0, 0), make_pair(a, b));
    cin >> p1.first >> p1.second >> p2.first >> p2.second;
    p1.first--;
    p1.second--;
    cin >> p3.first >> p3.second >> p4.first >> p4.second;
    p3.first--;
    p3.second--;
    pair<pair<unsigned long long, unsigned long long>,
         pair<unsigned long long, unsigned long long> >
        tmp = overlapPoint(p1, p2, p3, p4);
    p5 = tmp.first;
    p6 = tmp.second;
    w1 = f(p1, p2);
    w2 = f(p5, p6);
    w3 = f(p3, p4);
    w1.first -= w2.first;
    w1.second -= w2.second;
    k.first -= w1.first;
    k.second += w1.first;
    k.second -= w3.second;
    k.first += w3.second;
    cout << k.second << " " << k.first << endl;
  }
  return 0;
}
