#include <bits/stdc++.h>
using namespace std;
long long n, m;
int t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int xu[2], yu[2], xd[2], yd[2];
    for (int i = 0; i < 2; i++) {
      cin >> xd[i] >> yd[i] >> xu[i] >> yu[i];
    }
    long long tot = n * m;
    long long white = (tot + 1) / 2;
    long long black = tot - white;
    if ((xd[0] + yd[0]) % 2 == 0) {
      long long mm = xu[0] - xd[0] + 1;
      long long nn = yu[0] - yd[0] + 1;
      long long tt = nn * mm;
      long long ww = (tt + 1) / 2;
      long long bb = tt - ww;
      white += bb;
      black -= bb;
    } else {
      long long mm = xu[0] - xd[0] + 1;
      long long nn = yu[0] - yd[0] + 1;
      long long tt = nn * mm;
      long long bb = (tt + 1) / 2;
      long long ww = tt - bb;
      white += bb;
      black -= bb;
    }
    if ((xd[1] + yd[1]) % 2 == 0) {
      long long mm = xu[1] - xd[1] + 1;
      long long nn = yu[1] - yd[1] + 1;
      long long tt = nn * mm;
      long long ww = (tt + 1) / 2;
      long long bb = tt - ww;
      white -= ww;
      black += ww;
    } else {
      long long mm = xu[1] - xd[1] + 1;
      long long nn = yu[1] - yd[1] + 1;
      long long tt = nn * mm;
      long long bb = (tt + 1) / 2;
      long long ww = tt - bb;
      white -= ww;
      black += ww;
    }
    long long xdmx = max(xd[0], xd[1]);
    long long ydmx = max(yd[0], yd[1]);
    long long xumi = min(xu[0], xu[1]);
    long long yumi = min(yu[0], yu[1]);
    if (xumi - xdmx >= 0 and yumi - ydmx >= 0) {
      if ((xdmx + ydmx) % 2 == 0) {
        long long mm = xumi - xdmx + 1;
        long long nn = yumi - ydmx + 1;
        long long tt = nn * mm;
        long long ww = (tt + 1) / 2;
        long long bb = tt - ww;
        black += bb;
        white -= bb;
      } else {
        long long mm = xumi - xdmx + 1;
        long long nn = yumi - ydmx + 1;
        long long tt = nn * mm;
        long long bb = (tt + 1) / 2;
        long long ww = tt - bb;
        black += bb;
        white -= bb;
      }
    }
    cout << white << ' ' << black << '\n';
  }
  return 0;
}
