#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const double PI = 3.141592653589793;
long long n, m, xa, ya, xb, yb, xx, yy, z, k, k2;
long long res;
int main() {
  cin >> z;
  while (z--) {
    cin >> n >> m >> xa >> ya >> xb >> yb;
    if (xa > xb) {
      swap(xa, xb);
      swap(ya, yb);
    }
    if (ya > yb) swap(ya, yb);
    if (xa == xb) {
      swap(xa, ya);
      swap(xb, yb);
      swap(n, m);
    }
    k = n - (xb - xa);
    k2 = m - (yb - ya);
    res = 0;
    if (2 * k < n) res += (n - 2 * k) * 1LL * m;
    res += min((xb - xa), k) * 2LL * (yb - ya);
    if (2 * k > n && 2 * k2 < m) res += (m - 2 * k2) * 1LL * (2 * k - n);
    cout << res << endl;
  }
  return 0;
}
