#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;


int main(){
  int n;
  while(scanf("%d",&n),n){
    typedef set<pair<int,int> > S;
    S s;
    REP(i,n){
      int x,y; scanf("%d%d",&x,&y);
      s.insert(mp(x,y));
    }

    int ans = 0;
    for(S::iterator it1 = s.begin(); it1 != s.end(); it1++){
      for(S::iterator it2 = s.begin(); it2 != s.end(); it2++){
        if(it1 == it2) continue;
        int x1 = it1->f;
        int y1 = it1->s;
        int x2 = it2->f;
        int y2 = it2->s;
        int dx = x2 - x1;
        int dy = y2 - y1;
        int x3 = x1 - dy;
        int y3 = y1 + dx;
        int x4 = x2 - dy;
        int y4 = y2 + dx;


        if(s.find(mp(x3,y3)) != s.end() && s.find(mp(x4,y4)) != s.end()){
#define DBL(x) ((x)*(x))
          ans = max(ans, DBL(x1-x2)+DBL(y1-y2));
        }
      }
    }
    printf("%d\n",ans);
  }

  return 0;
}