#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int MOD = (int)1e9 + 7;
const int p = 239;
const int MAX_N = 10;
const long double pi = 3.1415926535897932384626;
const long double eps = 1e-6;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long long n, m, x1, y1, x2, y2;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2;
    if (x1 > x2) {
      x1 += x2;
      x2 = x1 - x2;
      x1 -= x2;
    }
    if (y1 > y2) {
      y1 += y2;
      y2 = y1 - y2;
      y1 -= y2;
    }
    x2 -= (x1 - 1);
    x1 = 1;
    y2 -= (y1 - 1);
    y1 = 1;
    cout << n * m - 2 * (n - x2 + 1) * (m - y2 + 1) +
                max(0LL, n - x2 * 2 + 2) * max(0LL, m - y2 * 2 + 2)
         << endl;
  }
  return 0;
}
