#include <bits/stdc++.h>
using namespace std;
long long cdiv(long long x, long long y) { return x / y + (x % y > 0); }
long long w(long long a, long long b) {
  return cdiv(a, 2) * cdiv(b, 2) + (a / 2) * (b / 2);
}
long long W(long long x1, long long y1, long long x2, long long y2) {
  return w(x2, y2) - w(x2, y1 - 1) - w(x1 - 1, y2) + w(x1 - 1, y1 - 1);
}
long long B(long long x1, long long y1, long long x2, long long y2) {
  return (y2 - y1 + 1) * (x2 - x1 + 1) - W(x1, y1, x2, y2);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int x1, x2, x3, x4, y1, y2, y3, y4;
    long long n, m;
    cin >> n >> m;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long long white = W(1, 1, m, n);
    long long black = B(1, 1, m, n);
    white = white + B(x1, y1, x2, y2);
    black = black - B(x1, y1, x2, y2);
    white = white - W(x3, y3, x4, y4);
    black = black + W(x3, y3, x4, y4);
    if (max(x1, x3) <= min(x2, x4) && max(y1, y3) <= min(y2, y4)) {
      white = white - B(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
      black = black + B(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
    }
    cout << white << ' ' << black << '\n';
  }
}
