#include <bits/stdc++.h>
using namespace std;
struct point {
  long long x;
  long long y;
  point(long long _x, long long _y) : x(_x), y(_y) {}
  bool operator<=(const point& p) { return x <= p.x && y <= p.y; }
};
long long sq(point& p1, point& p2) {
  return (abs(p1.x - p2.x) + 1) * (abs(p1.y - p2.y) + 1);
}
long long minx(vector<point>& points) {
  long long res = points[0].x;
  for (const auto& p : points) res = min(res, p.x);
  return res;
}
long long maxx(vector<point>& points) {
  long long res = points[0].x;
  for (const auto& p : points) res = max(res, p.x);
  return res;
}
long long miny(vector<point>& points) {
  long long res = points[0].y;
  for (const auto& p : points) res = min(res, p.y);
  return res;
}
long long maxy(vector<point>& points) {
  long long res = points[0].y;
  for (const auto& p : points) res = max(res, p.y);
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int ts;
  cin >> ts;
  for (int t = 0; t < ts; t++) {
    long long n, m, x1, y1, x2, y2;
    cin >> n >> m >> x1 >> y1 >> x2 >> y2;
    point a(x1, y1);
    point b(x2, y2);
    if (b <= a) {
      swap(x1, x2);
      swap(y1, y2);
    }
    long long up = min(abs(1 - x1), abs(1 - x2));
    long long down = min(abs(n - x1), abs(n - x2));
    long long left = min(abs(1 - y1), abs(1 - y2));
    long long right = min(abs(m - y1), abs(m - y2));
    vector<point> as;
    as.push_back(point(x1 - up, y1 - left));
    as.push_back(point(x1 - up, y1 + right));
    as.push_back(point(x1 + down, y1 + right));
    as.push_back(point(x1 + down, y1 - left));
    vector<point> bs;
    bs.push_back(point(x2 - up, y2 - left));
    bs.push_back(point(x2 - up, y2 + right));
    bs.push_back(point(x2 + down, y2 + right));
    bs.push_back(point(x2 + down, y2 - left));
    point p1(max(minx(as), minx(bs)), max(miny(as), miny(bs)));
    point p2(min(maxx(as), maxx(bs)), min(maxy(as), maxy(bs)));
    long long sum = sq(as[0], as[2]) + sq(bs[0], bs[2]);
    if (p1 <= p2) sum -= sq(p1, p2);
    cout << (n * m) - sum << '\n';
  }
  return 0;
}
