#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 5;
const long long mod = 1e9 + 7;
long long solve() {
  long long x1, x2, x3, x4, y1, y2, y3, y4, n, m;
  cin >> n >> m;
  cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
  swap(x1, y1);
  swap(x2, y2);
  swap(x3, y3);
  swap(x4, y4);
  long long x5 = max(x1, x3);
  long long y5 = max(y1, y3);
  long long x6 = min(x2, x4);
  long long y6 = min(y2, y4);
  if (!(x5 <= x6 and y5 <= y6)) {
    long long c = n * m, temp_white, temp_black;
    long long white = c % 2 + c / 2, black = c / 2;
    long long l = abs(x2 - x1) + 1, r = abs(y2 - y1) + 1;
    l *= r;
    if ((x1 % 2 and y1 % 2) || (x2 % 2 == 0 and y2 % 2 == 0)) {
      temp_black = l / 2;
      temp_white = l % 2 + l / 2;
    } else {
      temp_black = l / 2 + l % 2;
      temp_white = l / 2;
    }
    white += temp_black;
    black -= temp_black;
    l = abs(x4 - x3) + 1, r = abs(y4 - y3) + 1;
    l *= r;
    if ((x3 % 2 and y3 % 2) || (x4 % 2 == 0 and y4 % 2 == 0)) {
      temp_black = l / 2;
      temp_white = l % 2 + l / 2;
    } else {
      temp_black = l / 2 + l % 2;
      temp_white = l / 2;
    }
    white -= temp_white;
    black += temp_white;
    assert(white >= 0 and black >= 0);
    return cout << white << ' ' << black << '\n', 0;
  }
  long long c = n * m, temp_white, temp_black;
  long long white = c % 2 + c / 2, black = c / 2;
  long long l = abs(x2 - x1) + 1, r = abs(y2 - y1) + 1;
  l *= r;
  if ((x1 % 2 and y1 % 2) || (x2 % 2 == 0 and y2 % 2 == 0)) {
    temp_black = l / 2;
    temp_white = l % 2 + l / 2;
  } else {
    temp_black = l / 2 + l % 2;
    temp_white = l / 2;
  }
  white += temp_black;
  black -= temp_black;
  l = abs(x4 - x3) + 1, r = abs(y4 - y3) + 1;
  l *= r;
  if ((x3 % 2 and y3 % 2) || (x4 % 2 == 0 and y4 % 2 == 0)) {
    temp_white = l % 2 + l / 2;
    temp_black = l / 2;
  } else {
    temp_white = l / 2;
    temp_black = l / 2 + l % 2;
  }
  black += temp_white;
  white -= temp_white;
  l = (abs(x5 - x6) + 1) * (abs(y5 - y6) + 1);
  if ((x5 % 2 and y5 % 2) || (x6 % 2 == 0 and y6 % 2 == 0)) {
    temp_black = l / 2;
    temp_white = l % 2 + l / 2;
  } else {
    temp_black = l / 2 + l % 2;
    temp_white = l / 2;
  }
  black += temp_black;
  white -= temp_black;
  cout << white << ' ' << black << '\n';
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
