#include <bits/stdc++.h>
using namespace std;
int nextInt() {
  int ret = 0, sign = 1;
  char c = ' ';
  while (!isdigit(c = getchar())) {
    if (c == EOF) return -1;
    if (c == '-') sign = -1;
  }
  do {
    ret = ret * 10 + (c - '0');
  } while (isdigit(c = getchar()));
  return ret * sign;
}
void printlineInt(int num) {
  char str[101];
  if (num < 0)
    num = -num, putchar('-');
  else if (num == 0) {
    puts("0");
    return;
  }
  str[100] = '\0';
  int i = 99;
  for (; num; i--) {
    str[i] = num % 10 + '0';
    num /= 10;
  }
  puts(&str[i + 1]);
  return;
}
char table[4][4];
int main() {
  int T = nextInt();
  for (int ii = 0; ii < (int)T; ii++) {
    long long n = nextInt(), m = nextInt();
    int x1 = nextInt(), y1 = nextInt();
    int x2 = nextInt(), y2 = nextInt();
    if (x1 > x2) swap(x1, x2), swap(y1, y2);
    if (y1 > y2) swap(x1, x2), swap(y1, y2);
    vector<pair<int, int> > sq1, sq2;
    long long ans = 0;
    sq1.push_back(make_pair(1, 1));
    sq2.push_back(make_pair(1 + abs(x2 - x1), 1LL + abs(y2 - y1)));
    sq1.push_back(make_pair(n - abs(x2 - x1), 1));
    sq2.push_back(make_pair(n, 1 + abs(y2 - y1)));
    sq1.push_back(make_pair(n - abs(x2 - x1), m - abs(y2 - y1)));
    sq2.push_back(make_pair(n, m));
    sq1.push_back(make_pair(1, m - abs(y2 - y1)));
    sq2.push_back(make_pair(1 + abs(x2 - x1), m));
    ans += (long long)(sq1[1].first - sq1[0].first + 1) *
           (sq1[2].second - sq1[0].second + 1) * 2;
    if (sq1[2].first >= sq2[0].first && sq1[2].second >= sq2[0].second) {
      ans -= (long long)(sq1[2].first - sq2[0].first + 1) *
             (sq1[2].second - sq2[0].second + 1);
    }
    cout << n * m - ans << endl;
  }
}
