#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <vector>
using namespace std;
#define max(a,b) ((a)>=(b)?(a):(b))
typedef pair<int,int> P;
vector<P> points;
bool field[5001][5001];
int main() {
	int n;
	while(scanf("%d",&n),n) {
		memset(field,0,sizeof(field));
		points.clear();
		for(int i=0;i<n;i++) {
			int x,y;
			scanf("%d %d",&x,&y);
			field[x][y]=true;
			points.push_back(make_pair(x,y));
		}
		int S=0;
		for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) {
			int dx=points[j].first-points[i].first;
			int dy=points[j].second-points[i].second;
			int x1=points[j].first+dy,y1=points[j].second-dx;
			int x2=x1-dx,y2=y1-dy;
			if(0>x1||x1>5000||0>y1||y1>5000) continue;
			if(0>x2||x2>5000||0>y2||y2>5000) continue;
			if(!field[x1][y1]||!field[x2][y2]) continue;
			S=max(S,dx*dx+dy*dy);
		}
		printf("%d\n",S);
	}
}