#include <bits/stdc++.h>

using namespace std;

int N;
set<pair<int, int> > PointInfo;
set<pair<int, int> >::iterator CurPos, NextPos, EndPos;

int solve() {
	int dx, dy, x1, y1, x2, y2, nextX1, nextY1, nextX2, nextY2, area;

	area = 0;
	EndPos = PointInfo.end();
	for (CurPos = PointInfo.begin(); CurPos != EndPos; ++CurPos) {
		NextPos = ++CurPos;
		--CurPos;
		while (NextPos != EndPos) {
			x1 = CurPos->first;
			y1 = CurPos->second;
			x2 = NextPos->first;
			y2 = NextPos->second;
			dx = x2 - x1;
			dy = abs(y2 - y1);

			nextX1 = x1 + dy;
			nextX2 = x2 + dy;
			nextY1 = y1 - dx;
			nextY2 = y2 - dx;
			if (PointInfo.count({ nextX1,nextY1 }) == 1 && PointInfo.count({ nextX2,nextY2 }) == 1) {
				area = max(area, dx*dx + dy*dy);
			}

			nextY1 = y1 + dx;
			nextY2 = y2 + dx;
			if (PointInfo.count({ nextX1,nextY1 }) == 1 && PointInfo.count({ nextX2,nextY2 }) == 1) {
				area = max(area, dx*dx + dy*dy);
			}
			++NextPos;
		}
	}

	return area;
}

int main() {
	int x, y;

	while (cin >> N, N) {
		PointInfo.clear();
		for (int i = 0; i < N; ++i) {
			cin >> x >> y;
			PointInfo.insert({ x,y });
		}
		cout << solve() << endl;
	}

	return 0;
}
