#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m, x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2, b0, sumt,
        sumd, n1, n2, m1, m2, n3, m3, x5 = 0, y5 = 0, x6 = 0, y6 = 0, a3;
    cin >> n >> m;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    n1 = x2 - x1 + 1;
    m1 = y2 - y1 + 1;
    n2 = x4 - x3 + 1;
    m2 = y4 - y3 + 1;
    if (x1 % 2 == y1 % 2)
      a1 = 0;
    else
      a1 = 1;
    if (x2 % 2 == y2 % 2)
      b1 = 0;
    else
      b1 = 1;
    if (x3 % 2 == y3 % 2)
      a2 = 0;
    else
      a2 = 1;
    if (x4 % 2 == y4 % 2)
      b2 = 0;
    else
      b2 = 1;
    if (n % 2 == m % 2)
      b0 = 0;
    else
      b0 = 1;
    if (n % 2 == 1 && m % 2 == 1) {
      sumt = (n * m + 1) / 2;
      sumd = (n * m - 1) / 2;
    } else {
      sumt = (n * m) / 2;
      sumd = (n * m) / 2;
    }
    if (y2 >= y3 && y2 <= y4) {
      y6 = y2;
    } else if (y2 > y4) {
      y6 = y4;
    }
    if (y1 >= y3 && y1 <= y4) {
      y5 = y1;
    } else if (y1 < y3) {
      y5 = y3;
    }
    if (x1 >= x3 && x1 <= x4) {
      x5 = x1;
    } else if (x1 < x3) {
      x5 = x3;
    }
    if (x2 >= x3 && x2 <= x4) {
      x6 = x2;
    } else if (x2 > x4) {
      x6 = x4;
    }
    n3 = x6 - x5 + 1;
    m3 = y6 - y5 + 1;
    if (x5 % 2 == y5 % 2)
      a3 = 0;
    else
      a3 = 1;
    if (a1 == 0) {
      if (n1 % 2 == 1 && m1 % 2 == 1) {
        sumt += (n1 * m1 - 1) / 2;
        sumd -= (n1 * m1 - 1) / 2;
      } else {
        sumt += (n1 * m1) / 2;
        sumd -= (n1 * m1) / 2;
      }
    } else {
      if (n1 % 2 == 1 && m1 % 2 == 1) {
        sumt += (n1 * m1 + 1) / 2;
        sumd -= (n1 * m1 + 1) / 2;
      } else {
        sumt += (n1 * m1) / 2;
        sumd -= (n1 * m1) / 2;
      }
    }
    if (a2 == 1) {
      if (n2 % 2 == 1 && m2 % 2 == 1) {
        sumd += (n2 * m2 - 1) / 2;
        sumt -= (n2 * m2 - 1) / 2;
      } else {
        sumd += (n2 * m2) / 2;
        sumt -= (n2 * m2) / 2;
      }
    } else {
      if (n2 % 2 == 1 && m2 % 2 == 1) {
        sumd += (n2 * m2 + 1) / 2;
        sumt -= (n2 * m2 + 1) / 2;
      } else {
        sumd += (n2 * m2) / 2;
        sumt -= (n2 * m2) / 2;
      }
    }
    if (x5 != 0 && x6 != 0 && y5 != 0 && y6 != 0) {
      if (a3 == 0) {
        if (n3 % 2 == 1 && m3 % 2 == 1) {
          sumd += (n3 * m3 - 1) / 2;
          sumt -= (n3 * m3 - 1) / 2;
        } else {
          sumd += (n3 * m3) / 2;
          sumt -= (n3 * m3) / 2;
        }
      } else {
        if (n3 % 2 == 1 && m3 % 2 == 1) {
          sumd += (n3 * m3 + 1) / 2;
          sumt -= (n3 * m3 + 1) / 2;
        } else {
          sumd += (n3 * m3) / 2;
          sumt -= (n3 * m3) / 2;
        }
      }
    }
    cout << sumt << " " << sumd << endl;
  }
}
