#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x, y, b, w, sl;
    cin >> x >> y;
    b = (x * y) / 2;
    w = (x * y + 1) / 2;
    long long wx1, wy1, wx2, wy2;
    long long bx1, by1, bx2, by2;
    cin >> wx1 >> wy1 >> wx2 >> wy2;
    cin >> bx1 >> by1 >> bx2 >> by2;
    long long gx1, gy1, gx2, gy2;
    gx1 = max(wx1, bx1);
    gy1 = max(wy1, by1);
    gx2 = min(wx2, bx2);
    gy2 = min(wy2, by2);
    sl = ((wx2 - wx1 + 1) * (wy2 - wy1 + 1)) / 2;
    if (((wx2 - wx1 + 1) * (wy2 - wy1 + 1)) % 2 && ((wx1 + wy1) % 2)) sl++;
    w += sl;
    b -= sl;
    sl = ((gx2 - gx1 + 1) * (gy2 - gy1 + 1)) / 2;
    if ((gx2 - gx1 + 1) > 0 && (gy2 - gy1 + 1) > 0) {
      if (((gx2 - gx1 + 1) * (gy2 - gy1 + 1)) % 2 && ((gx1 + gy1) % 2)) sl++;
      w -= sl;
      b += sl;
    }
    sl = ((bx2 - bx1 + 1) * (by2 - by1 + 1)) / 2;
    if (((bx2 - bx1 + 1) * (by2 - by1 + 1)) % 2 && ((bx1 + by1) % 2 == 0)) sl++;
    b += sl;
    w -= sl;
    cout << w << " " << b << endl;
  }
}
