#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;
typedef long long ll;
int n;
vector <point> xy;
bool used[5001][5001];
ll ans;

void check(point a,point b){
  point d=b-a;
  point e=point(0,abs(d));
  point f=point(abs(d),abs(d));
  e=(e*d/abs(d))+a;
  f=(f*d/abs(d))+a;
  a=e,b=f;
  int ax=a.x,ay=a.y,bx=b.x,by=b.y;

  if(ax<0||ay<0||bx<0||by<0||5000<ax||5000<bx||5000<ay||5000<by)return;
  if(a.x==ax&&b.x==bx&&a.y==ay&&b.y==by&&used[ax][ay]&&used[bx][by])ans=max(ans,ll(d.x*d.x+d.y*d.y));
  
}

int main(){
  while(cin>>n,n){
    xy.clear();
    memset(used,0,sizeof(used));
    for(int i=0,a,b;i<n;i++){
      cin>>a>>b;
      used[a][b]=1;
      xy.push_back(point(a,b));
    }
    ans=0;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)if(i!=j)check(xy[i],xy[j]);
    cout <<ans<<endl;
  }
  return 0;
}