#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;

#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()
const int INF = 1<<29;

typedef pair<int,int> pii;
#define F first
#define S second
int main() {
  int n;
  while(cin >> n,n) {
    set<pii> se;
    REP(i,n) {
      int x,y;
      cin >> x >> y;
      se.insert(pii(x,y));
    }
    int res = 0;
    FOR(it,se) {
      FOR (jt,se) {
        int vx = it->F - jt->F;
        int vy = it->S - jt->S;
        int s = vx*vx+vy*vy;
        if (s <= res) continue;
        if (se.count(pii(it->F-vy,it->S+vx)) && se.count(pii(jt->F-vy,jt->S+vx))) 
          res = s;
      }
    }
    cout << res << endl;
  }
}