#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
int main() {
  ios::sync_with_stdio(false);
  long long t, n, m, x1, x2, x3, x4, y1, y2, y3, y4, i1, i2, j1, j2, ans;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    x1--;
    y1--;
    x3--;
    y3--;
    ans = 0;
    long long minx = min(x3, x4);
    long long miny = min(y1, y2);
    ans += n * m / 2;
    if ((n * m) % 2 == 1) ans++;
    ans += (x2 - x1) * (y2 - y1) / 2;
    if (((x2 - x1) * (y2 - y1) % 2 == 1) && ((x1 + y1) % 2 == 1)) ans++;
    ans -= (x4 - x3) * (y4 - y3) / 2;
    if (((x4 - x3) * (y4 - y3) % 2 == 1) && ((x3 + y3) % 2 == 0)) ans--;
    i1 = max(x1, x3);
    j1 = max(y1, y3);
    i2 = min(x2, x4);
    j2 = min(y2, y4);
    if ((i2 - i1) >= 0 && (j2 - j1) >= 0) {
      ans -= (i2 - i1) * (j2 - j1) / 2;
      if (((i2 - i1) * (j2 - j1) % 2 == 1) && ((i1 + j1) % 2 == 1)) ans--;
    }
    cout << ans << " " << n * m - ans << endl;
  }
  return 0;
}
