#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long int n, m, x1, y1, x2, y2;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2;
    long long int a, b, sum;
    if (y1 > y2) {
      int y = y1;
      y1 = y2;
      y2 = y;
    }
    if (x1 > x2) {
      int x = x1;
      x1 = x2;
      x2 = x;
    }
    a = x1 + n - x2;
    b = y1 + m - y2;
    sum = a * b * 2;
    if (a * 2 > n && b * 2 > m) sum -= (a * 2 - n) * (b * 2 - m);
    sum = n * m - sum;
    cout << sum << endl;
  }
  return 0;
}
