#include <bits/stdc++.h>
using namespace std;
bool isWhite(long long x, long long y) {
  if (x % 2 == 0) {
    if (y % 2 == 0) {
      return true;
    } else {
      return false;
    }
  } else {
    if (y % 2 == 0) {
      return false;
    } else {
      return true;
    }
  }
}
long long getNum(long long x1, long long y1, long long x2, long long y2,
                 bool color) {
  long long width = x2 - x1 + 1;
  long long height = y2 - y1 + 1;
  long long half = (width * height) / 2;
  if (((width * height) % 2) == 1) {
    if (isWhite(x1, y1) == color) half++;
  }
  return half;
}
int main(int argc, const char* argv[]) {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc;
  cin >> tc;
  for (int c = 0; c < tc; c++) {
    long long n, m;
    cin >> n >> m;
    long long white_num = (n * m) / 2;
    if (((n * m) % 2) == 1) {
      white_num++;
    }
    long long wx1, wy1, wx2, wy2;
    cin >> wx1 >> wy1 >> wx2 >> wy2;
    white_num += getNum(wx1, wy1, wx2, wy2, false);
    long long bx1, by1, bx2, by2;
    cin >> bx1 >> by1 >> bx2 >> by2;
    white_num -= getNum(bx1, by1, bx2, by2, true);
    long long nx1 = max(wx1, bx1);
    long long ny1 = max(wy1, by1);
    long long nx2 = min(wx2, bx2);
    long long ny2 = min(wy2, by2);
    if (nx1 <= nx2 && ny1 <= ny2) {
      white_num -= getNum(nx1, ny1, nx2, ny2, false);
    }
    long long board = n * m;
    long long ans1 = white_num;
    long long ans2 = board - white_num;
    cout << ans1 << " " << ans2 << "\n";
  }
  return 0;
}
