#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long cw = (n * m + 1) / 2, cb = n * m / 2;
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long tmp = ((x2 - x1 + 1) * (y2 - y1 + 1) + ((x1 + y1) & 1)) / 2;
    cb -= tmp, cw += tmp;
    long long x3, y3, x4, y4, l, r, b, t;
    cin >> x3 >> y3 >> x4 >> y4;
    l = max(x1, x3), r = min(x2, x4), b = max(y1, y3), t = min(y2, y4);
    long long cnt = 0;
    if (l <= r && b <= t) cnt += (r - l + 1) * (t - b + 1);
    tmp = ((x4 - x3 + 1) * (y4 - y3 + 1) + ((~(x3 + y3)) & 1)) / 2 -
          (l <= r && b <= t ? ((r - l + 1) * (t - b + 1) + ((~(l + b)) & 1)) / 2
                            : 0) +
          cnt;
    cb += tmp, cw -= tmp;
    cout << cw << " " << cb << '\n';
  }
  return 0;
}
