#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int MX = 1000 + 7;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    long long tot = n * m;
    long long blacks = tot / 2;
    long long madewhite = ((x2 - x1 + 1) * (y2 - y1 + 1) + (x1 + y1 & 1)) / 2;
    long long madeblack = ((x4 - x3 + 1) * (y4 - y3 + 1) + !(x3 + y3 & 1)) / 2;
    long long x5 = max(x1, x3), y5 = max(y1, y3);
    long long x6 = min(x2, x4), y6 = min(y2, y4);
    long long madeblack_again =
        (x5 <= x6 && y5 <= y6) *
        ((x6 - x5 + 1) * (y6 - y5 + 1) + (x5 + y5 & 1)) / 2;
    blacks = blacks - madewhite + madeblack + madeblack_again;
    cout << tot - blacks << ' ' << blacks << endl;
  }
  return 0;
}
