#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long x, y;
  Point() {}
  Point(long long a, long long b) {
    x = a;
    y = b;
  }
};
int dx[5], dy[5];
long long getb(Point a, Point b) {
  long long sum = (b.x - a.x + 1) * (b.y - a.y + 1);
  long long ans = sum / 2;
  if (sum % 2 != 0) {
    if ((a.x + a.y) % 2 == 0) {
      ans++;
    }
  }
  return ans;
}
long long geth(Point a, Point b) {
  long long sum = (b.x - a.x + 1) * (b.y - a.y + 1);
  long long ans = sum / 2;
  if (sum % 2 != 0) {
    if ((a.x + a.y) % 2 != 0) {
      ans++;
    }
  }
  return ans;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, m, bx1, by1, bx2, by2, hx1, hy1, hx2, hy2;
    cin >> n >> m;
    cin >> bx1 >> by1 >> bx2 >> by2;
    cin >> hx1 >> hy1 >> hx2 >> hy2;
    Point b1(bx1, by1), b2(bx2, by2), h1(hx1, hy1), h2(hx2, hy2);
    dx[1] = bx1;
    dx[2] = bx2;
    dx[3] = hx1;
    dx[4] = hx2;
    dy[1] = by1;
    dy[2] = by2;
    dy[3] = hy1;
    dy[4] = hy2;
    sort(dx + 1, dx + 5);
    sort(dy + 1, dy + 5);
    Point zhong1(dx[2], dy[2]), zhong2(dx[3], dy[3]);
    long long hei1 = geth(b1, b2), hei2 = geth(h1, h2),
              hei3 = geth(zhong1, zhong2);
    long long bai1 = getb(b1, b2), bai2 = getb(h1, h2),
              bai3 = getb(zhong1, zhong2);
    if (b1.y > h2.y || h1.y > b2.y || b2.x < h1.x || h2.x < b1.x)
      hei3 = 0, bai3 = 0;
    long long nowh = hei1 + hei2 - hei3;
    long long nowb = bai1 + bai2 - bai3;
    long long Areab = (b2.x - b1.x + 1) * (b2.y - b1.y + 1);
    long long Areah = (h2.x - h1.x + 1) * (h2.y - h1.y + 1);
    long long Areazhong = (zhong2.x - zhong1.x + 1) * (zhong2.y - zhong1.y + 1);
    if (b1.y > h2.y || h1.y > b2.y || b2.x < h1.x || h2.x < b1.x) Areazhong = 0;
    long long ans1 = getb(Point(1, 1), Point(n, m)),
              ans2 = geth(Point(1, 1), Point(n, m));
    ans1 = ans1 - nowb + (Areab - Areazhong);
    ans2 = ans2 - nowh + Areah;
    cout << ans1 << " " << ans2 << endl;
  }
}
