#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long int n, m;
    cin >> n >> m;
    pair<long long int, long long int> a, b, c, d, e, f;
    scanf("%lld %lld %lld %lld", &a.first, &a.second, &b.first, &b.second);
    scanf("%lld %lld %lld %lld", &c.first, &c.second, &d.first, &d.second);
    e.first = max(a.first, c.first), e.second = max(a.second, c.second);
    f.first = min(b.first, d.first), f.second = min(b.second, d.second);
    long long int cnt = n * m, wh, bl;
    wh = bl = cnt / 2;
    if (cnt % 2) {
      wh++;
    }
    cnt = (b.first - a.first + 1) * (b.second - a.second + 1);
    wh += (cnt / 2);
    bl -= (cnt / 2);
    if (cnt % 2 && a.first % 2 != a.second % 2) wh++, bl--;
    cnt = (d.first - c.first + 1) * (d.second - c.second + 1);
    wh -= (cnt / 2);
    bl += (cnt / 2);
    if (cnt % 2 && c.first % 2 == c.second % 2) wh--, bl++;
    if (f.first - e.first + 1 > 0 && f.second - e.second + 1 > 0) {
      cnt = (f.first - e.first + 1) * (f.second - e.second + 1);
      wh -= cnt / 2;
      bl += cnt / 2;
      if (cnt % 2 && e.first % 2 != e.second % 2) wh--, bl++;
    }
    printf("%lld %lld\n", wh, bl);
  }
  return 0;
}
