#include <bits/stdc++.h>
using namespace std;
int main() {
  int cs;
  scanf("%d", &cs);
  while (cs--) {
    int n, m, x1, x2, y1, y2, dx = 0, dy = 0;
    scanf("%d%d%d%d%d%d", &n, &m, &x1, &y1, &x2, &y2);
    int L = min(x1 - 1, x2 - 1);
    int R = min(n - x1, n - x2);
    int U = min(y1 - 1, y2 - 1);
    int D = min(m - y1, m - y2);
    if (x1 + R >= x2 - L && x1 + R <= x2 + R) dx = (x1 - x2 + L + R + 1);
    if (x2 + R >= x1 - L && x2 + R <= x1 + R) dx = (x2 - x1 + L + R + 1);
    if (y1 + D >= y2 - U && y1 + D <= y2 + D) dy = (y1 - y2 + U + D + 1);
    if (y2 + D >= y1 - U && y2 + D <= y1 + D) dy = (y2 - y1 + U + D + 1);
    printf("%I64d\n",
           1ll * n * m - 2ll * (L + R + 1) * (U + D + 1) + 1ll * dx * dy);
  }
}
