#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long t;
long long x1, x2, x3, x4, x5, x6, y11, y2, y3, y4, y5, y6;
long long black = 0LL;
long long white = 0LL;
long long solve(long long x) {
  if (x == 0) return 0;
  if (x % 2)
    return (x + 1) / -2;
  else
    return x / 2;
}
void paint(long long x, long long y, long long flag) {
  if (flag == 0) {
    black += (x * y) / 2;
    white += (x * y) - black;
  } else if (flag == 1) {
    if (x1 % 2 == y11 % 2) {
      black -= (x * y) / 2;
      white += (x * y) / 2;
    } else {
      black -= (x * y - (x * y) / 2);
      white += (x * y - (x * y) / 2);
    }
  } else if (flag == 2) {
    long long auxi = (x * y) / 2;
    if (x3 % 2 == y3 % 2) {
      white -= (x * y - auxi);
      black += (x * y - auxi);
    } else {
      white -= auxi;
      black += auxi;
    }
  } else if (flag == 3) {
    white -= (x * y);
    black += (x * y);
    long long og;
    if (x5 % 2 == y5 % 2)
      og = (x * y) - ((x * y) / 2);
    else
      og = ((x * y) / 2);
    long long auxi1 = x4 - x3 + 1, auxi2 = y4 - y3 + 1;
    long long auxi = (auxi1 * auxi2) / 2;
    if (x3 % 2 == y3 % 2) {
      white -= (auxi1 * auxi2 - og - auxi);
      black += (auxi1 * auxi2 - og - auxi);
    } else {
      white -= (auxi - og);
      black += (auxi - og);
    }
  }
}
bool intersect(long long x1, long long x2, long long x3, long long x4,
               long long y11, long long y2, long long y3, long long y4) {
  if (x1 > x4 || x2 < x3) return false;
  if (y11 > y4 || y2 < y3) return false;
  return true;
}
int main() {
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n, m;
    cin >> n >> m;
    cin >> x1 >> y11 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    black = 0LL;
    white = 0LL;
    paint(n, m, 0);
    paint(x2 - x1 + 1, y2 - y11 + 1, 1);
    x5 = max(x1, x3);
    y5 = max(y11, y3);
    x6 = min(x2, x4);
    y6 = min(y2, y4);
    if (intersect(x1, x2, x3, x4, y11, y2, y3, y4) ||
        intersect(x3, x4, x1, x2, y3, y4, y11, y2)) {
      paint(x6 - x5 + 1, y6 - y5 + 1, 3);
    } else
      paint(x4 - x3 + 1, y4 - y3 + 1, 2);
    cout << white << " " << black << "\n";
  }
  return 0;
}
