#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long n, m, x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long ans1 = n * m / 2, ans2 = n * m / 2;
    if (n % 2 == 1 && m % 2 == 1) ans1 += 1;
    long long a1 = x2 - x1 + 1, b1 = y2 - y1 + 1;
    ans1 += a1 * b1 / 2, ans2 -= a1 * b1 / 2;
    if ((x1 + y1) % 2 == 1) {
      if (a1 * b1 % 2 == 1) ans1 += 1, ans2 -= 1;
    }
    long long a2 = x4 - x3 + 1, b2 = y4 - y3 + 1;
    ans1 -= a2 * b2 / 2, ans2 += a2 * b2 / 2;
    if ((x3 + y3) % 2 == 0) {
      if (a2 * b2 % 2 == 1) ans1 -= 1, ans2 += 1;
    }
    long long n1, n2, m1, m2;
    n1 = min(max(x1, x2), max(x3, x4));
    m1 = min(max(y1, y2), max(y3, y4));
    n2 = max(min(x1, x2), min(x3, x4));
    m2 = max(min(y1, y2), min(y3, y4));
    if (n1 >= n2 && m1 >= m2) {
      swap(n1, n2);
      swap(m1, m2);
      long long a3 = n2 - n1 + 1, b3 = m2 - m1 + 1;
      ans1 -= a3 * b3 / 2, ans2 += a3 * b3 / 2;
      if ((m1 + n1) % 2 == 1) {
        if (a3 % 2 == 1 && b3 % 2 == 1) ans1 -= 1, ans2 += 1;
      }
    }
    cout << ans1 << ' ' << ans2 << endl;
  }
}
