#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 13;
int Tt;
int main() {
  cin >> Tt;
  while (Tt--) {
    long long n, m;
    cin >> n >> m;
    long long xa, ya, xb, yb;
    long long l = 0, r = 0;
    scanf("%lld%lld%lld%lld", &xa, &ya, &xb, &yb);
    if (xb < xa) {
      swap(xa, xb), swap(ya, yb);
    }
    long long dxa = min(xa, xb) - 1, dxb = min(n - xa, n - xb), distX = xb - xa;
    long long dya = min(ya, yb) - 1, dyb = min(m - ya, m - yb),
              distY = max(ya, yb) - min(ya, yb);
    bool Xx = 0, Yy = 0;
    long long ans = 2 * (dxa + dxb + 1) * (dya + dyb + 1);
    if (distX < dxa + dxb + 1) {
      l = dxa + dxb + 1 - distX, Xx = 1;
    }
    if (distY < dya + dyb + 1) r = dya + dyb + 1 - distY, Yy = 1;
    if (Xx || Yy) ans -= l * r;
    printf("%lld\n", n * m * 1ll - ans);
  }
  return 0;
}
