#include<bits/stdc++.h>
#define N 3000
using namespace std;
typedef pair<int,int> P;
set<P> s;

int main(){
  int n,ans;
  P p[N];
  while(1){
    ans=0;
    cin>>n;
    if(!n)break;
    for(int i=0;i<n;i++){
      cin>>p[i].first>>p[i].second;
      s.insert(p[i]);
    }
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	int x1=p[i].first,y1=p[i].second;
	int x2=p[j].first,y2=p[j].second;
	int X=x2-x1,Y=y2-y1;
	if(s.find(P(x1+Y,y1-X))!=s.end())
	  if(s.find(P(x2+Y,y2-X))!=s.end())
	    ans=max(ans,Y*Y+X*X);
	if(s.find(P(x1-Y,y1+X))!=s.end())
	  if(s.find(P(x2-Y,y2+X))!=s.end())
	    ans=max(ans,Y*Y+X*X);
      }
    }
    cout<<ans<<endl;
    s.clear();
  }
  return 0;
}