#include <bits/stdc++.h>
using namespace std;
long long t, n, m, a, b, c, d;
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> m >> a >> b >> c >> d;
    if (a > c) {
      swap(a, c);
      swap(b, d);
    }
    long long left = min(b - 1, d - 1);
    long long right = min(m - b, m - d);
    long long up = min(a - 1, c - 1);
    long long down = min(n - a, n - c);
    long long r1 = a - up, r2 = a + down, c1 = b - left, c2 = b + right;
    long long x1 = c - up, x2 = c + down, y1 = d - left, y2 = d + right;
    long long res =
        (r2 - r1 + 1) * (c2 - c1 + 1) + (x2 - x1 + 1) * (y2 - y1 + 1);
    long long w = 0, h = 0;
    if (b < d) {
      w = max(r2 - x1 + 1, 0ll);
      h = max(c2 - y1 + 1, 0ll);
    } else {
      w = max(r2 - x1 + 1, 0ll);
      h = max(y2 - c1 + 1, 0ll);
    }
    cout << n * m - (res - w * h) << endl;
  }
}
