#include <bits/stdc++.h>
using namespace std;
pair<long long int, long long int> count_white(long long int n,
                                               long long int m) {
  return {(long long int)(ceil((n * m) / 2.)),
          (long long int)(floor((n * m) / 2.))};
}
pair<long long int, long long int> count_black(long long int n,
                                               long long int m) {
  return {(long long int)(floor((n * m) / 2.)),
          (long long int)(ceil((n * m) / 2.))};
}
pair<pair<long long int, long long int>, pair<long long int, long long int>>
intersec(long long int ax, long long int ay, long long int bx, long long int by,
         long long int cx, long long int cy, long long int dx,
         long long int dy) {
  long long int x = min(bx, dx) - max(ax, cx);
  long long int y = min(by, dy) - max(ay, cy);
  if (x < 0 || y < 0)
    return {{-1, -1}, {-1, -1}};
  else
    return {{max(ax, cx), max(ay, cy)}, {min(bx, dx), min(by, dy)}};
}
int main() {
  long long int q;
  cin >> q;
  for (long long int i = 0; i < q; ++i) {
    long long int n, m;
    cin >> n >> m;
    long long int ax, ay, bx, by, cx, cy, dx, dy;
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
    long long int w = count_white(n, m).first;
    long long int b = count_white(n, m).second;
    if ((ax % 2 + ay % 2) % 2) {
      b -= count_black(by - ay + 1, bx - ax + 1).second;
      w += count_black(by - ay + 1, bx - ax + 1).second;
    } else {
      b -= count_white(by - ay + 1, bx - ax + 1).second;
      w += count_white(by - ay + 1, bx - ax + 1).second;
    }
    pair<pair<long long int, long long int>, pair<long long int, long long int>>
        itr = intersec(ax, ay, bx, by, cx, cy, dx, dy);
    if (itr.first.first != -1) {
      if ((itr.first.first % 2 + itr.first.second % 2) % 2) {
        w -= count_black(itr.second.second - itr.first.second + 1,
                         itr.second.first - itr.first.first + 1)
                 .second;
        b += count_black(itr.second.second - itr.first.second + 1,
                         itr.second.first - itr.first.first + 1)
                 .second;
      } else {
        w -= count_white(itr.second.second - itr.first.second + 1,
                         itr.second.first - itr.first.first + 1)
                 .second;
        b += count_white(itr.second.second - itr.first.second + 1,
                         itr.second.first - itr.first.first + 1)
                 .second;
      }
    }
    if ((cx % 2 + cy % 2) % 2) {
      w -= count_black(dy - cy + 1, dx - cx + 1).first;
      b += count_black(dy - cy + 1, dx - cx + 1).first;
    } else {
      w -= count_white(dy - cy + 1, dx - cx + 1).first;
      b += count_white(dy - cy + 1, dx - cx + 1).first;
    }
    cout << w << " " << b << endl;
  }
}
