/* Problem URL: https://codeforces.com/contest/2114/problem/D */

#include <bits/stdc++.h>

using namespace std;

#define V vector

#define rmin(a, b) a = min(a, b)
#define rmax(a, b) a = max(a, b)

#define rep(i, lim) for (int i = 0; i < (lim); i++)
#define nrep(i, s, lim) for (int i = s; i < (lim); i++)

#define repv(i, v) for (auto &i : (v))
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
#define sortv(v) sort(v.begin(), v.end())
#define all(v) (v).begin(), (v).end()

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vvvvi = vector<vvvi>;

using ll = long long;

using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vvvvl = vector<vvvl>;

template<class v>
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
    os << vec[0];
    for (size_t i = 1; i < vec.size(); i++) {
        os << ' ' << vec[i];
    }
    os << '\n';
    return os;
}

template<class v>
auto operator>>(istream &is, vector<v> &vec)->istream& {
    for (auto &i : vec) {
        is >> i;
    }
    return is;
}

template<class v>
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
    for (auto &i : vec) {
        os << i[0];
        for (size_t j = 1; j < i.size(); j++) {
            os << ' ' << i[j];
        }
        os << '\n';
    }
    return os;
}

template<class v>
auto operator>>(istream  &is, vector<vector<v>> &vec)->istream& {
    for (auto &i : vec) {
        for (auto &j : i) {
            is >> j;
        }
    }
    return is;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;

        V<pair<ll, ll>> fds(n);
        repv(i, fds) {
            cin >> i.first >> i.second;
        }

        if (n == 1) {
            cout << 1 << '\n';
            continue;
        }

        ll inf = INT64_MAX >> 1;
        priority_queue<pair<ll, ll>> minx;
        minx.emplace(inf, inf);
        minx.emplace(inf, inf);
        priority_queue<pair<ll, ll>, V<pair<ll, ll>>, greater<>> maxx;
        maxx.emplace(0, 0);
        maxx.emplace(0, 0);
        priority_queue<pair<ll, ll>> miny;
        miny.emplace(inf, inf);
        miny.emplace(inf, inf);
        priority_queue<pair<ll, ll>, V<pair<ll, ll>>, greater<>> maxy;
        maxy.emplace(0, 0);
        maxy.emplace(0, 0);

        repv(i, fds) {
            minx.emplace(i.first, i.second);
            minx.pop();
            maxx.emplace(i.first, i.second);
            maxx.pop();
            miny.emplace(i.second, i.first);
            miny.pop();
            maxy.emplace(i.second, i.first);
            maxy.pop();
        }

        pair<ll, ll> minx2 = minx.top();
        minx.pop();
        pair<ll, ll> minx1 = minx.top();


        pair<ll, ll> maxx2 = maxx.top();
        maxx.pop();
        pair<ll, ll> maxx1 = maxx.top();


        pair<ll, ll> miny2 = miny.top();
        miny.pop();
        pair<ll, ll> miny1 = miny.top();

        pair<ll, ll> maxy2 = maxy.top();
        maxy.pop();
        pair<ll, ll> maxy1 = maxy.top();

        ll ans = inf;

        rmin(ans, (maxx1.first - minx1.first + 1) * (maxy1.first - miny1.first + 1));

        if ((maxx2.first - minx1.first + 1) * (maxy1.first - miny1.first + 1) <= n - 1) {
            rmin(ans, (maxx2.first - minx1.first + 1) * (maxy1.first - miny1.first + 2));
            rmin(ans, (maxx2.first - minx1.first + 2) * (maxy1.first - miny1.first + 1));
        } else {
            rmin(ans, (maxx2.first - minx1.first + 1) * (maxy1.first - miny1.first + 1));
        }
        if ((maxx1.first - minx2.first + 1) * (maxy1.first - miny1.first + 1) <= n - 1) {
            rmin(ans, (maxx1.first - minx2.first + 1) * (maxy1.first - miny1.first + 2));
            rmin(ans, (maxx1.first - minx2.first + 2) * (maxy1.first - miny1.first + 1));
        } else {
            rmin(ans, (maxx1.first - minx2.first + 1) * (maxy1.first - miny1.first + 1));
        }
        if ((maxx1.first - minx1.first + 1) * (maxy2.first - miny1.first + 1) <= n - 1) {
            rmin(ans, (maxx1.first - minx1.first + 2) * (maxy2.first - miny1.first + 1));
            rmin(ans, (maxx1.first - minx1.first + 1) * (maxy2.first - miny1.first + 2));
        } else {
            rmin(ans, (maxx1.first - minx1.first + 1) * (maxy2.first - miny1.first + 1));
        }
        if ((maxx1.first - minx1.first + 1) * (maxy1.first - miny2.first + 1) <= n - 1) {
            rmin(ans, (maxx1.first - minx1.first + 2) * (maxy1.first - miny2.first + 1));
            rmin(ans, (maxx1.first - minx1.first + 1) * (maxy1.first - miny2.first + 2));
        } else {
            rmin(ans, (maxx1.first - minx1.first + 1) * (maxy1.first - miny2.first + 1));
        }

        if (maxx1.first == maxy1.second && maxx1.second == maxy1.first) {
            if ((maxx2.first - minx1.first + 1) * (maxy2.first - miny1.first + 1) > n - 1) {
                rmin(ans, (maxx2.first - minx1.first + 1) * (maxy2.first - miny1.first + 1));
            } else {
                rmin(ans, (maxx2.first - minx1.first + 1) * (maxy2.first - miny1.first + 2));
                rmin(ans, (maxx2.first - minx1.first + 2) * (maxy2.first - miny1.first + 1));
            }
        }
        if (minx1.first == miny1.second && minx1.second == miny1.first) {
            if ((maxx1.first - minx2.first + 1) * (maxy1.first - miny2.first + 1) > n - 1) {
                rmin(ans, (maxx1.first - minx2.first + 1) * (maxy1.first - miny2.first + 1));
            } else {
                rmin(ans, (maxx1.first - minx2.first + 1) * (maxy1.first - miny2.first + 2));
                rmin(ans, (maxx1.first - minx2.first + 2) * (maxy1.first - miny2.first + 1));
            }
        }

        if (minx1.first == maxy1.second && minx1.second == maxy1.first) {
            if ((maxx1.first - minx2.first + 1) * (maxy2.first - miny1.first + 1) > n - 1) {
                rmin(ans, (maxx1.first - minx2.first + 1) * (maxy2.first - miny1.first + 1));
            } else {
                rmin(ans, (maxx1.first - minx2.first + 2) * (maxy2.first - miny1.first + 1));
                rmin(ans, (maxx1.first - minx2.first + 1) * (maxy2.first - miny1.first + 2));
            }
        }
        if (maxx1.first == miny1.second && maxx1.second == miny1.first) {
            if ((maxx2.first - minx1.first + 1) * (maxy1.first - miny2.first + 1) > n - 1) {
                rmin(ans, (maxx2.first - minx1.first + 1) * (maxy1.first - miny2.first + 1));
            } else {
                rmin(ans, (maxx2.first - minx1.first + 2) * (maxy1.first - miny2.first + 1));
                rmin(ans, (maxx2.first - minx1.first + 1) * (maxy1.first - miny2.first + 2));
            }
        }

        cout << ans << '\n';
    }
}
