#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, M, w, b, T, x, y;
  long long int A1, B1, C1, D1, A2, B2, C2, D2;
  long long int A3, B3, C3, D3;
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld %lld", &N, &M);
    w = b = N * M / 2;
    if (N * M % 2) w++;
    scanf("%lld %lld %lld %lld", &A1, &B1, &C1, &D1);
    scanf("%lld %lld %lld %lld", &A2, &B2, &C2, &D2);
    A3 = max(A1, A2);
    B3 = max(B1, B2);
    C3 = min(C1, C2);
    D3 = min(D1, D2);
    if (C3 < A3 || D3 < B3) {
      x = (C1 - A1 + 1) * (D1 - B1 + 1) / 2;
      y = (C1 - A1 + 1) * (D1 - B1 + 1) / 2;
      if ((C1 - A1 + 1) * (D1 - B1 + 1) % 2) {
        if ((A1 + B1) % 2)
          x++;
        else
          y++;
      }
      w += x;
      b -= x;
      x = (C2 - A2 + 1) * (D2 - B2 + 1) / 2;
      y = (C2 - A2 + 1) * (D2 - B2 + 1) / 2;
      if ((C2 - A2 + 1) * (D2 - B2 + 1) % 2) {
        if ((A2 + B2) % 2)
          x++;
        else
          y++;
      }
      b += y;
      w -= y;
    } else {
      x = (C1 - A1 + 1) * (D1 - B1 + 1) / 2;
      y = (C1 - A1 + 1) * (D1 - B1 + 1) / 2;
      if ((C1 - A1 + 1) * (D1 - B1 + 1) % 2) {
        if ((A1 + B1) % 2)
          x++;
        else
          y++;
      }
      w += x;
      b -= x;
      x = (C3 - A3 + 1) * (D3 - B3 + 1) / 2;
      y = (C3 - A3 + 1) * (D3 - B3 + 1) / 2;
      if ((C3 - A3 + 1) * (D3 - B3 + 1) % 2) {
        if ((A3 + B3) % 2)
          x++;
        else
          y++;
      }
      w -= x;
      b += x;
      x = (C2 - A2 + 1) * (D2 - B2 + 1) / 2;
      y = (C2 - A2 + 1) * (D2 - B2 + 1) / 2;
      if ((C2 - A2 + 1) * (D2 - B2 + 1) % 2) {
        if ((A2 + B2) % 2)
          x++;
        else
          y++;
      }
      b += y;
      w -= y;
    }
    printf("%lld %lld\n", w, b);
  }
  return 0;
}
