#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll wir(ll x, ll y, ll a, ll b) {
  if (a < x || b < y) return 0;
  if ((x + y) % 2 == 1) {
    return (a + 1 - x) * (b + 1 - y) / 2;
  }
  return ((a + 1 - x) * (b + 1 - y) + 1) / 2;
}
ll bir(ll x, ll y, ll a, ll b) {
  if (a < x || b < y) return 0;
  return (a + 1 - x) * (b + 1 - y) - wir(x, y, a, b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  while (n--) {
    ll a, b;
    cin >> a >> b;
    ll T[8];
    for (int i = 0; i < 8; ++i) cin >> T[i];
    ll wh = wir(1, 1, a, b);
    ll bl = bir(1, 1, a, b);
    ll ileb = bir(T[0], T[1], T[2], T[3]);
    wh += ileb;
    bl -= ileb;
    ll ilecz = wir(T[4], T[5], T[6], T[7]);
    wh -= ilecz;
    bl += ilecz;
    ll wsp =
        bir(max(T[0], T[4]), max(T[1], T[5]), min(T[2], T[6]), min(T[3], T[7]));
    wh -= wsp;
    bl += wsp;
    cout << wh << " " << bl << (char)10;
  }
}
