#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  int col;
  long long black, white, black1, white1;
  long long n, m, x1, y1, x2, y2, x3, y3, x4, y4, area, area1;
  long long x5, y5, x6, y6;
  while (t--) {
    cin >> n >> m;
    area = n * m;
    black = area / 2;
    white = area - black;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    x5 = max(x1, x3);
    y5 = max(y1, y3);
    x6 = min(x2, x4);
    y6 = min(y2, y4);
    if (x6 >= x5 && y6 >= y6)
      area1 = (x6 - x5 + 1) * (y6 - y5 + 1);
    else
      area1 = 0;
    if (area1 < 0) area1 = 0;
    if ((x1 + y1) % 2 == 0)
      col = 1;
    else
      col = 0;
    area = (x2 - x1 + 1) * (y2 - y1 + 1);
    if (col) {
      black1 = area / 2;
      white1 = area - black1;
    } else {
      white1 = area / 2;
      black1 = area - white1;
    }
    black -= black1;
    white += black1;
    area = (x4 - x3 + 1) * (y4 - y3 + 1);
    if ((x3 + y3) % 2 == 0)
      col = 1;
    else
      col = 0;
    if (col) {
      black1 = area / 2;
      white1 = area - black1;
    } else {
      white1 = area / 2;
      black1 = area - white1;
    }
    black += white1;
    white -= white1;
    if ((x5 + y5) % 2 == 0)
      col = 1;
    else
      col = 0;
    if (col) {
      black1 = area1 / 2;
      white1 = area1 - black1;
    } else {
      white1 = area1 / 2;
      black1 = area1 - white1;
    }
    black += black1;
    white -= black1;
    cout << white << " " << black << "\n";
  }
  return 0;
}
