#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    long long x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;
    long long size = n * m;
    long long w = (size + 1) / 2;
    long long b = size - w;
    if ((x1 + y1) % 2 == 0) {
      long long n1, m1;
      n1 = x2 - x1 + 1;
      m1 = y2 - y1 + 1;
      long long sz = n1 * m1;
      long long bb = sz / 2;
      b -= bb;
      w += bb;
    } else {
      long long n1, m1;
      n1 = x2 - x1 + 1;
      m1 = y2 - y1 + 1;
      long long sz = n1 * m1;
      long long bb = (sz + 1) / 2;
      b -= bb;
      w += bb;
    }
    long long x5 = max(x1, x3);
    long long y5 = max(y1, y3);
    long long x6 = min(x2, x4);
    long long y6 = min(y2, y4);
    if (x5 > x6 || y5 > y6) {
      if ((x3 + y3) % 2 == 0) {
        long long n1, m1;
        n1 = x4 - x3 + 1;
        m1 = y4 - y3 + 1;
        long long sz = n1 * m1;
        long long ww = (sz + 1) / 2;
        b += ww;
        w -= ww;
      } else {
        long long n1, m1;
        n1 = x4 - x3 + 1;
        m1 = y4 - y3 + 1;
        long long sz = n1 * m1;
        long long ww = sz / 2;
        b += ww;
        w -= ww;
      }
    } else {
      long long n1, m1;
      n1 = x6 - x5 + 1;
      m1 = y6 - y5 + 1;
      long long sz = n1 * m1;
      w -= sz;
      b += sz;
      long long n2, m2;
      n2 = x4 - x3 + 1;
      m2 = y4 - y3 + 1;
      long long sz1 = n2 * m2;
      if (sz1 != sz) {
        long long c1, d1, c2, d2;
        if ((x5 + y5) % 2 == 0) {
          c1 = (sz + 1) / 2;
          d1 = sz - c1;
        } else {
          c1 = sz / 2;
          d1 = sz - c1;
        }
        if ((x3 + y3) % 2 == 0) {
          c2 = (sz1 + 1) / 2;
          d2 = sz1 - c1;
        } else {
          c2 = sz1 / 2;
          d2 = sz1 - c1;
        }
        long long ne1, ne2;
        ne1 = c2 - c1;
        ne2 = d2 - d1;
        w -= ne1;
        b += ne1;
      }
    }
    cout << w << " " << b << endl;
  }
}
