#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#define ni(i) (i)*(i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll n;
set<P> s;
P d[3000];
ll ans=0;
bool ok(ll a,ll b){
	P v=P(d[b].first-d[a].first,d[b].second-d[a].second);
	P A=d[a];
	P B=d[b];
	return (s.count(P(B.first+v.second,B.second-v.first)) && s.count(P(A.first+v.second,A.second-v.first)) )
				|| (s.count(P(B.first-v.second,B.second+v.first)) && s.count(P(A.first-v.second,A.second+v.first)) );
}


int main()
{while(1){
	ans=0;
	cin>>n;
	if(!n) return 0;
	s.clear();
	for(ll i=0;i<n;i++){
		cin>>d[i].first>>d[i].second;
		s.insert(d[i]);
	}
	for(ll i=0;i<n;i++){
		for(ll j=i+1;j<n;j++){
			if(ni(d[i].first-d[j].first)+ni(d[i].second-d[j].second)>ans&&ok(i,j)){
				ans=ni(d[i].first-d[j].first)+ni(d[i].second-d[j].second);
			}
		}
	}
	cout<<ans<<endl;
}}