#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define INF 1e+9;
using namespace std;

int main() {
	int n,ma;
	int x[3000],y[3000];
	vector<int> pos;
	while(cin >> n,n){
		pos.clear();
		ma = 0;
		for(int i = 0;i < n;i++){
			cin >> x[i] >> y[i];
			pos.push_back(x[i] * 10000 + y[i]);
		}
		sort(pos.begin(),pos.end());
		for(int i = 0;i < n;i++){
			for(int j = 0;j < n;j++){
				if(i == j) continue;
				int dx = x[j] - x[i],dy = y[j] - y[i];
				int kx = x[j] - dy,ky = y[j] + dx;
				int lx = kx - dx,ly = ky - dy;
				if(kx >= 0 && ky >= 0 && lx >= 0 && ly >= 0){
					if(upper_bound(pos.begin(),pos.end(),kx * 10000 + ky) - lower_bound(pos.begin(),pos.end(),kx * 10000 + ky) == 1 && upper_bound(pos.begin(),pos.end(),lx * 10000 + ly) - lower_bound(pos.begin(),pos.end(),lx * 10000 + ly) == 1){
						ma = max(ma,dx * dx + dy * dy);
					}
				}
			}
		}
		cout << ma << endl;
	}
	return 0;
}