#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans;
  int s, n, m, x1, x2, y1, y2, x, y;
  scanf("%d", &s);
  for (int i = 1; i <= s; i++) {
    ans = 0;
    scanf("%d%d%d%d%d%d", &n, &m, &x1, &y1, &x2, &y2);
    if (x1 > x2)
      x = x1 - x2;
    else
      x = x2 - x1;
    if (y1 > y2)
      y = y1 - y2;
    else
      y = y2 - y1;
    if (x + y == 0)
      ans = 0;
    else if ((x == 0) || (y == 0)) {
      if (x == 0) {
        if (2 * y <= m)
          ans = 0;
        else
          ans = (long long)n * (2 * y - m);
      }
      if (y == 0) {
        if (2 * x <= n)
          ans = 0;
        else
          ans = (long long)m * (2 * x - n);
      }
    } else if ((x == n - 1) && (y == m - 1)) {
      ans = (long long)m * n - 2;
    } else if ((n == m) && (n % 2 != 0) && (m % 2 != 0) &&
               (((x == n - 1) && (y == m / 2)) ||
                ((y == m - 1) && (x == n / 2)))) {
      ans = (long long)n * m - (long long)2 * (n / 2 + 1);
    } else if (((2 * x - n > 0) && (2 * y - m > 0)) && (n > 2) && (m > 2)) {
      ans = (long long)n * m - (long long)2 * (m - y) * (n - x);
    } else if (((2 * x - n > 0) || (2 * y - m > 0)) && (n > 2) && (m > 2)) {
      if (2 * x - n > 0)
        ans = (long long)n * m - (long long)2 * (m - y) * (n - x);
      if (2 * y - m > 0)
        ans = (long long)n * m - (long long)2 * (n - x) * (m - y);
    } else {
      ans = (long long)2 * x * y;
    }
    cout << ans << endl;
  }
  return 0;
}
