#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long ans1, ans2;
    long long n, m;
    cin >> n >> m;
    ans1 = n * m / 2;
    ans2 = ans1;
    if (n * m % 2) ans1++;
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long white1 = (x2 - x1 + 1) * (y2 - y1 + 1) / 2;
    long long black1 = white1;
    if ((x2 - x1 + 1) * (y2 - y1 + 1) % 2) {
      if (abs(x2 - y2) % 2)
        black1++;
      else
        white1++;
    }
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    long long white2 = (x4 - x3 + 1) * (y4 - y3 + 1) / 2;
    long long black2 = white2;
    if ((x4 - x3 + 1) * (y4 - y3 + 1) % 2) {
      if (abs(x4 - y3) % 2)
        black2++;
      else
        white2++;
    }
    long long x5 = max(x1, x3), y5 = max(y1, y3), x6 = min(x2, x4),
              y6 = min(y2, y4);
    long long white = 0, black = 0;
    if (x5 <= x6 && y5 <= y6) {
      long long gapx = x6 - x5 + 1;
      long long gapy = y6 - y5 + 1;
      white = gapx * gapy / 2;
      black = white;
      if (gapx * gapy % 2) {
        if (abs(x5 - y5) % 2)
          black++;
        else
          white++;
      }
    }
    ans1 -= white;
    ans2 -= black;
    white1 -= white;
    black1 -= black;
    white2 -= white;
    black2 -= black;
    ans1 += black1;
    ans2 -= black1;
    ans2 += white2;
    ans1 -= white2;
    ans2 += white + black;
    cout << ans1 << " " << ans2 << '\n';
  }
  return 0;
}
