#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
#define FORN(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define INF 2000000000
void remove_duplicates(vector<int>& vec) {
sort( vec.begin(), vec.end() );
vec.erase( unique( vec.begin(), vec.end() ), vec.end() );
}
int t, n, x, y;
vector<PII> pts;
vector<int> ux, uy;
map<int, int> ycnt;
int main() {
scanf("%d", &t);
while (t--) {
vector<PII>().swap(pts);
vector<int>().swap(ux);
vector<int>().swap(uy);
scanf("%d", &n);
FORN(i, n) {
scanf("%d", &x);
scanf("%d", &y);
pts.PB(MP(x, y));
ux.PB(x);
uy.PB(y);
}
if (n == 1) {
printf("0\n");
continue;
}
sort(pts.begin(), pts.end());
remove_duplicates(ux);
remove_duplicates(uy);
int res = INF;
for (int i = 0; i < uy.size(); i++) {
int ym = uy[i];
for (int j = i; j < uy.size(); j++) {
int yM = uy[j];
// set up left and right pointers
int pl = 0;
while (pts[pl].SS < ym || pts[pl].SS > yM) pl++;
int rect = 1; int pr = pl;
while (rect < n / 2 + 1 && pr + 1 < n) {
pr++;
if (pts[pr].SS >= ym && pts[pr].SS <= yM) rect++;
}
if (rect < n / 2 + 1) continue;
res = min(res, (yM - ym) * (pts[pr].FF - pts[pl].FF));
while (1) {
pl++; while (pl < n && (pts[pl].SS < ym || pts[pl].SS > yM)) pl++;
pr++; while (pr < n && (pts[pr].SS < ym || pts[pr].SS > yM)) pr++;
if (pr < n) {
res = min(res, (yM - ym) * (pts[pr].FF - pts[pl].FF));
}
else {
break;
}
}
}
}
printf("%d\n", res);
}
return 0;
}
I2luY2x1ZGU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iB5Y250OwoKaW50IG1haW4oKSB7CiAgICBzY2FuZigiJWQiLCAmdCk7CgogICAgd2hpbGUgKHQtLSkgewogICAgICAgIHZlY3RvcjxQSUk+KCkuc3dhcChwdHMpOwogICAgICAgIHZlY3RvcjxpbnQ+KCkuc3dhcCh1eCk7CiAgICAgICAgdmVjdG9yPGludD4oKS5zd2FwKHV5KTsKCiAgICAgICAgc2NhbmYoIiVkIiwgJm4pOwoKICAgICAgICBGT1JOKGksIG4pIHsKICAgICAgICAgICAgc2NhbmYoIiVkIiwgJngpOwogICAgICAgICAgICBzY2FuZigiJWQiLCAmeSk7CiAgICAgICAgICAgIHB0cy5QQihNUCh4LCB5KSk7CiAgICAgICAgICAgIHV4LlBCKHgpOwogICAgICAgICAgICB1eS5QQih5KTsKICAgICAgICB9CgogICAgICAgIGlmIChuID09IDEpIHsKICAgICAgICAgICAgcHJpbnRmKCIwXG4iKTsKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgfQoKICAgICAgICBzb3J0KHB0cy5iZWdpbigpLCBwdHMuZW5kKCkpOwogICAgICAgIHJlbW92ZV9kdXBsaWNhdGVzKHV4KTsKICAgICAgICByZW1vdmVfZHVwbGljYXRlcyh1eSk7CgogICAgICAgIGludCByZXMgPSBJTkY7CgogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdXkuc2l6ZSgpOyBpKyspIHsKICAgICAgICAgICAgaW50IHltID0gdXlbaV07CiAgICAgICAgICAgIGZvciAoaW50IGogPSBpOyBqIDwgdXkuc2l6ZSgpOyBqKyspIHsKICAgICAgICAgICAgICAgIGludCB5TSA9IHV5W2pdOwoKICAgICAgICAgICAgICAgIC8vIHNldCB1cCBsZWZ0IGFuZCByaWdodCBwb2ludGVycwogICAgICAgICAgICAgICAgaW50IHBsID0gMDsKICAgICAgICAgICAgICAgIHdoaWxlIChwdHNbcGxdLlNTIDwgeW0gfHwgcHRzW3BsXS5TUyA+IHlNKSBwbCsrOwogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpbnQgcmVjdCA9IDE7IGludCBwciA9IHBsOwogICAgICAgICAgICAgICAgd2hpbGUgKHJlY3QgPCBuIC8gMiArIDEgJiYgcHIgKyAxIDwgbikgewogICAgICAgICAgICAgICAgICAgIHByKys7CiAgICAgICAgICAgICAgICAgICAgaWYgKHB0c1twcl0uU1MgPj0geW0gJiYgcHRzW3ByXS5TUyA8PSB5TSkgcmVjdCsrOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIGlmIChyZWN0IDwgbiAvIDIgKyAxKSBjb250aW51ZTsKICAgICAgICAgICAgICAgIHJlcyA9IG1pbihyZXMsICh5TSAtIHltKSAqIChwdHNbcHJdLkZGIC0gcHRzW3BsXS5GRikpOwoKICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7CiAgICAgICAgICAgICAgICAgICAgcGwrKzsgd2hpbGUgKHBsIDwgbiAmJiAocHRzW3BsXS5TUyA8IHltIHx8IHB0c1twbF0uU1MgPiB5TSkpIHBsKys7CiAgICAgICAgICAgICAgICAgICAgcHIrKzsgd2hpbGUgKHByIDwgbiAmJiAocHRzW3ByXS5TUyA8IHltIHx8IHB0c1twcl0uU1MgPiB5TSkpIHByKys7CgogICAgICAgICAgICAgICAgICAgIGlmIChwciA8IG4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVzID0gbWluKHJlcywgKHlNIC0geW0pICogKHB0c1twcl0uRkYgLSBwdHNbcGxdLkZGKSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHByaW50ZigiJWRcbiIsIHJlcyk7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0K