#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    long long n, m;
    scanf("%lld%lld", &n, &m);
    long long black = n * m / 2;
    long long white = (n * m + 1) / 2;
    int x1, y1, x2, y2;
    int x3, y3, x4, y4;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    scanf("%d%d%d%d", &x3, &y3, &x4, &y4);
    long long area1 = (long long)(x2 - x1 + 1) * (y2 - y1 + 1);
    long long area2 = (long long)(x4 - x3 + 1) * (y4 - y3 + 1);
    long long b1 = 0, w1 = 0;
    long long b2 = 0, w2 = 0;
    if (area1 % 2 == 0)
      b1 = area1 / 2, w1 = b1;
    else {
      if (x1 % 2 != y1 % 2)
        b1 = area1 / 2 + 1, w1 = area1 / 2;
      else
        b1 = area1 / 2, w1 = area1 / 2 + 1;
    }
    if (area2 % 2 == 0)
      b2 = area2 / 2, w2 = b2;
    else {
      if (x3 % 2 != y3 % 2)
        b2 = area2 / 2 + 1, w2 = area2 / 2;
      else
        b2 = area2 / 2, w2 = area2 / 2 + 1;
    }
    int x5 = max(x1, x3);
    int y5 = max(y1, y3);
    int x6 = min(x2, x4);
    int y6 = min(y2, y4);
    black -= b1;
    white -= w1;
    white += area1;
    black -= b2;
    black += area2;
    white -= w2;
    if (x5 <= x6 && y5 <= y6) {
      long long area3 = (long long)(x6 - x5 + 1) * (y6 - y5 + 1);
      long long b3 = 0, w3 = 0;
      if (area3 % 2 == 0)
        b3 = area3 / 2, w3 = b3;
      else {
        if (x5 % 2 != y5 % 2)
          b3 = area3 / 2 + 1, w3 = area3 / 2;
        else
          b3 = area3 / 2, w3 = area3 / 2 + 1;
      }
      black += b3;
      white += w3;
      white -= area3;
    }
    printf("%lld %lld\n", white, black);
  }
}
