#include <bits/stdc++.h>
using namespace std;
void swap(long long *a, long long *b) {
  long long t = *a;
  *a = *b;
  *b = t;
}
int32_t main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long tc;
  cin >> tc;
  while (tc--) {
    long long ans = 0;
    long long n, m, x1, y1, x2, y2;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2;
    if (x1 > x2) {
      swap(&x1, &x2);
      swap(&y1, &y2);
    }
    long long smallans = 0;
    long long left = x1 + n - x2;
    long long right = x2 - x1 + 1;
    if (left >= right) {
      ans = ans + abs(y2 - y1) * (n - left);
      ans = ans + abs(y2 - y1) * (right - 1);
      long long hori = left - right + 1;
      if (y1 > y2) swap(&y1, &y2);
      long long maxdwn = y1 + m - y2;
      long long maxup = y2 - y1 + 1;
      if (maxdwn < maxup) {
        ans = ans + hori * (maxup - maxdwn - 1);
      }
    } else {
      ans = ans + (left)*abs(y2 - y1);
      ans = ans + (n - right + 1) * abs(y2 - y1);
      ans = ans + m * (right - left - 1);
    }
    cout << ans << "\n";
  }
}
