#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, x1, y1, x2, y2, cnt, h, l, i, t;
  long long v[4];
  cin >> t;
  while (t--) {
    cnt = 0;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2;
    v[0] = min(y1, y2) - 1;
    v[1] = min(x1, x2) - 1;
    v[2] = m - max(y1, y2);
    v[3] = n - max(x1, x2);
    for (i = 0; i < 4; i++) {
      cnt += v[i];
      if (i == 3)
        cnt += v[3] * v[0];
      else
        cnt += v[i] * v[i + 1];
    }
    if ((max(y1, y2) - v[0]) <= (min(y1, y2) + v[2]))
      h = v[2] + v[0] - abs(y1 - y2) + 1;
    else
      h = 0;
    if ((min(x1, x2) + v[3]) >= (max(x1, x2) - v[1]))
      l = v[1] + v[3] - abs(x1 - x2) + 1;
    else
      l = 0;
    cnt = m * n - cnt * 2 - 2 + l * h;
    cout << cnt << endl;
  }
}
