#include <bits/stdc++.h>
using namespace std;
const long long N = 101;
struct Point {
  long long x, y;
} pa, pb;
long long n, m;
long long iabs(long long t) {
  if (t > 0) return t;
  return -t;
}
int main() {
  long long T, i, j, k, dx, dy, tmp1, tmp2, cnt, idy;
  cin >> T;
  while (T--) {
    cin >> n >> m >> pa.x >> pa.y >> pb.x >> pb.y;
    dx = iabs(pa.x - pb.x);
    dy = iabs(pa.y - pb.y);
    if (2 * dy > m - 1) {
      tmp1 = 0;
      idy = m - dy;
    } else {
      if (2 * dx > n - 1)
        tmp1 = (m - 2 * dy) * (n - dx) * 2;
      else
        tmp1 = (m - 2 * dy) * n;
      idy = dy;
    }
    if (2 * dx > n - 1) {
      tmp2 = 2 * idy * (n - dx);
    } else {
      tmp2 = 2 * idy * (n - dx);
    }
    cnt = tmp1 + tmp2;
    cout << n * m - cnt << endl;
  }
}
