#include <bits/stdc++.h>
using namespace std;
const long long infl = 0x3f3f3f3f3f3f3f3fLL;
const long long infi = 0x3f3f3f3f;
const long long mod = 998244353;
long long mygcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return mygcd(b, a % b);
}
long long mypow(long long a, long long b, long long mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long long minx = (min(x1, x2));
  long long miny = min(y1, y2);
  long long maxx = max(x1, x2);
  long long maxy = max(y1, y2);
  long long up = minx - 1;
  long long down = n - maxx;
  long long left = miny - 1;
  long long right = m - maxy;
  pair<long long, long long> rx1 = {x1 - up, x1 + down};
  pair<long long, long long> rx2 = {x2 - up, x2 + down};
  pair<long long, long long> ry1 = {y1 - left, y1 + right};
  pair<long long, long long> ry2 = {y2 - left, y2 + right};
  long long tot1 = (rx1.second - rx1.first + 1) * (ry1.second - ry1.first + 1);
  long long tot2 = (rx2.second - rx2.first + 1) * (ry2.second - ry2.first + 1);
  long long ovx = min(rx1.second, rx2.second) - max(rx1.first, rx2.first) + 1;
  if (ovx < 0) {
    ovx = 0;
  }
  long long ovy = min(ry1.second, ry2.second) - max(ry1.first, ry2.first) + 1;
  if (ovy < 0) {
    ovy = 0;
  }
  long long toto = ovx * ovy;
  long long ans = tot1 + tot2 - toto;
  ans = (n * m) - ans;
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
