#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    long long tot1 = (x2 - x1 + 1) * (y2 - y1 + 1);
    long long x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    long long tot2 = (x4 - x3 + 1) * (y4 - y3 + 1);
    long long x5 = max(x1, x3);
    long long y5 = max(y1, y3);
    long long x6 = min(x2, x4);
    long long y6 = min(y2, y4);
    long long tot3 = (x6 - x5 + 1) * (y6 - y5 + 1);
    long long black = n * m / 2;
    long long white = (n * m) - black;
    if (x5 > x6 || y5 > y6) {
      long long b1, w1;
      if ((x1 + y1) % 2 == 0)
        b1 = tot1 / 2, w1 = tot1 - b1;
      else
        w1 = tot1 / 2, b1 = tot1 - w1;
      black -= b1;
      white += b1;
      if ((x3 + y3) % 2 == 0)
        b1 = tot2 / 2, w1 = tot2 - b1;
      else
        w1 = tot2 / 2, b1 = tot2 - w1;
      black += w1;
      white -= w1;
    } else {
      long long b1, w1;
      if ((x5 + y5) % 2 == 0)
        b1 = tot3 / 2, w1 = tot3 - b1;
      else
        w1 = tot3 / 2, b1 = tot3 - w1;
      black += w1;
      white -= w1;
      long long b2, w2;
      if ((x1 + y1) % 2 == 0)
        b2 = tot1 / 2, w2 = tot1 - b2;
      else
        w2 = tot1 / 2, b2 = tot1 - w2;
      b2 -= b1;
      black -= b2;
      white += b2;
      if ((x3 + y3) % 2 == 0)
        b2 = tot2 / 2, w2 = tot2 - b2;
      else
        w2 = tot2 / 2, b2 = tot2 - w2;
      w2 -= w1;
      black += w2;
      white -= w2;
    }
    cout << white << " " << black << endl;
  }
  return 0;
}
