#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> A, B, C, D;
long long inters() {
  long long x = (B.first - C.first + 1);
  if (x < 0LL) x = 0LL;
  long long y = (B.second - C.second + 1);
  if (y < 0LL) y = 0LL;
  return x * y;
}
int main() {
  int t;
  cin >> t;
  long long n, m, x, y, i, j;
  long long ret;
  long long tmp;
  while (t--) {
    ret = 0LL;
    cin >> n >> m >> x >> y >> i >> j;
    if (x > i) swap(x, i);
    if (y > j) swap(y, j);
    ret = n * m;
    tmp = min(x, i);
    A.first = x - tmp + 1LL;
    tmp = min(y, j);
    A.second = y - tmp + 1LL;
    tmp = n - max(x, i);
    B.first = x + tmp;
    tmp = m - max(y, j);
    B.second = y + tmp;
    tmp = min(x, i);
    C.first = i - tmp + 1LL;
    tmp = min(y, j);
    C.second = j - tmp + 1LL;
    tmp = n - max(x, i);
    D.first = i + tmp;
    tmp = m - max(y, j);
    D.second = j + tmp;
    ret -= (B.first - A.first + 1LL) * (B.second - A.second + 1LL);
    ret -= (D.first - C.first + 1LL) * (D.second - C.second + 1LL);
    ret += inters();
    cout << ret << endl;
  }
  return 0;
}
