#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> getbw(int x1, int y1, int x2, int y2) {
  if (x2 < x1 || y2 < y1) return {0, 0};
  long long lkiri = (x2 - x1 + 1);
  long long latas = y2 - y1 + 1;
  long long area = lkiri * latas;
  if (area % 2 == 0) return {area / 2, area / 2};
  long long wsum = 0;
  if ((x1 + y1) % 2 == 0)
    wsum = (lkiri + 1) / 2;
  else
    wsum = lkiri / 2;
  wsum = ((latas + 1) / 2) * wsum + latas / 2 * (lkiri - wsum);
  return {wsum, area - wsum};
}
int main() {
  ios_base::sync_with_stdio(false);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, m;
    cin >> n >> m;
    int x1, y1, x2, y2;
    pair<long long, long long> cnt = getbw(1, 1, m, n);
    cin >> x1 >> y1 >> x2 >> y2;
    pair<long long, long long> p1 = getbw(x1, y1, x2, y2);
    cnt.second -= p1.second;
    cnt.first += p1.second;
    int x3, y3, x4, y4;
    cin >> x3 >> y3 >> x4 >> y4;
    pair<long long, long long> p2 = getbw(x3, y3, x4, y4);
    cnt.first -= p2.first;
    cnt.second += p2.first;
    int ix1 = max(x1, x3), ix2 = min(x2, x4);
    int iy1 = max(y1, y3), iy2 = min(y2, y4);
    pair<long long, long long> p3 = getbw(ix1, iy1, ix2, iy2);
    cnt.first -= p3.second;
    cnt.second += p3.second;
    cout << cnt.first << " " << cnt.second << "\n";
  }
}
