#include <bits/stdc++.h>
using namespace std;
const long long nax = 3e5 + 5;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
long long n, m;
long long a[nax], b[nax];
vector<long long> adj[nax];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long a1, b1, c1, d1;
    cin >> a1 >> b1 >> c1 >> d1;
    long long B = 0;
    long long W = 0;
    long long t = n * m;
    if (t % 2 != 0) {
      B = t / 2;
      W = t / 2 + 1;
    } else {
      B = t / 2;
      W = t / 2;
    }
    long long w = (c - a + 1);
    long long h = (d - b + 1);
    long long A = w * h;
    if (A % 2 == 0) {
      B -= (A / 2);
      W -= (A / 2);
      W += (A);
    } else {
      if ((a + b) % 2 == 0) {
        B -= (A / 2);
        W -= (A / 2);
        W--;
        W += (A);
      } else {
        B -= (A / 2);
        B--;
        W -= (A / 2);
        W += A;
      }
    }
    long long m_x = max(a, a1);
    long long m_y = max(b, b1);
    if (m_x <= c && m_y <= d) {
      long long mn_x = min(c, c1);
      long long mn_y = min(d, d1);
      long long width = mn_x - m_x + 1;
      long long height = mn_y - m_y + 1;
      if (width > 0 && height > 0) {
        long long A = width * height;
        if (A % 2 == 0) {
          B += (A / 2);
          W -= (A / 2);
        } else {
          if ((m_x + m_y) % 2 == 0) {
            B = B + (A / 2);
            W = W - (A / 2);
          } else {
            B = B + (A / 2) + 1;
            W = W - (A / 2) - 1;
          }
        }
      }
    }
    w = abs(c1 - a1) + 1;
    h = abs(d1 - b1) + 1;
    A = w * h;
    if (A % 2 == 0) {
      B -= (A / 2);
      W -= (A / 2);
      B += (A);
    } else {
      if ((a1 + b1) % 2 == 0) {
        B -= (A / 2);
        W -= (A / 2);
        W--;
        B += (A);
      } else {
        B -= (A / 2);
        B--;
        W -= (A / 2);
        B += A;
      }
    }
    cout << W << " " << B << "\n";
  }
  return 0;
}
