#include <bits/stdc++.h>
using namespace std;
int main() {
  int nn;
  scanf("%d", &nn);
  while (nn--) {
    long long xs, ys;
    cin >> xs >> ys;
    long long x1, y1;
    cin >> x1 >> y1;
    long long x2, y2;
    cin >> x2 >> y2;
    long long xmove = xs - abs(x1 - x2);
    long long ymove = ys - abs(y1 - y2);
    long long xoverlap = max(0LL, 2 * xmove - xs);
    long long yoverlap = max(0LL, 2 * ymove - ys);
    cout << xs * ys - 2 * xmove * ymove + xoverlap * yoverlap << endl;
  }
  return 0;
}
