#include <bitset>
#include <cstring>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

// _ª éÀWÉ¶Ý·é©Ç¤©
bool isExited[5001][5001];

int main(){

	int n;
	while(cin>>n&&n!=0){
		int S = 0;
		// _ÌÀWði[
		pair<int,int> dots[3001];

		for(int i = 0; i < 5001; i++)
			fill(isExited[i],isExited[i]+5001,false);
		
		for(int i = 0; i < n; i++){
			cin>>dots[i].second>>dots[i].first;
			isExited[dots[i].first][dots[i].second]=true;
		}
		
		// ñ_ðIñÅA»Ìñ_Å³û`ªìêé©Ç¤©
		for(int i = 0; i < n; i++){
			for(int j = i+1; j < n; j++){
				// ñ_ÌìéxNg
				P v(dots[i].second-dots[j].second,dots[i].first-dots[j].first);
				// »Ì@üxNg
				P nv(-v.imag(),v.real());
				// @üxNgÌPÊxNg
				P nve(nv.real()/abs(nv),nv.imag()/abs(nv));
				// ãLÌPÊxNgðabs(v){·é
				P nveABSV(nve.real()*abs(v),nve.imag()*abs(v));
				// ãÌxNgðgÁÄ³û`ð\¬µ»¤È_ð©Â¯é
				P p1[2];
				P p2[2];
				p1[0] = P(nveABSV.real()+dots[i].second,nveABSV.imag()+dots[i].first);
				p1[1] = P(-nveABSV.real()+dots[i].second,-nveABSV.imag()+dots[i].first);
				p2[0] = P(nveABSV.real()+dots[j].second,nveABSV.imag()+dots[j].first);
				p2[1] = P(-nveABSV.real()+dots[j].second,-nveABSV.imag()+dots[j].first);

				// _ÌyAðìé
				pair<P,P> rec1,rec2;
				if(EQ(abs(p1[0]-p2[0]),abs(v))){
					rec1.first = p1[0];
					rec1.second = p2[0];
					rec2.first = p1[1];
					rec2.second = p2[1];
				}
				else{
					rec1.first = p1[0];
					rec1.second = p2[1];
					rec2.first = p1[1];
					rec2.second = p2[0];
				}

				// ±±Åmèµ½_ª¶Ý·êÎAÊÏðvZ
				if(abs((double)((int)(rec1.first.imag()+EPS))-rec1.first.imag()) < 0.0000001
					&&abs((double)((int)(rec1.first.real()+EPS))-rec1.first.real()) < 0.0000001
					&&abs((double)((int)(rec1.second.imag()+EPS))-rec1.second.imag()) < 0.0000001
					&&abs((double)((int)(rec1.second.real()+EPS))-rec1.second.real()) < 0.0000001){
						if((int)(rec1.first.imag()+EPS)>=0&&(int)(rec1.first.imag()+EPS)<=5000
							&&(int)(rec1.second.imag()+EPS)>=0&&(int)(rec1.second.imag()+EPS)<=5000
							&&(int)(rec1.first.real()+EPS)>=0&&(int)(rec1.first.real()+EPS)<=5000
							&&(int)(rec1.second.real()+EPS)>=0&&(int)(rec1.second.real()+EPS)<=5000){
								if(isExited[(int)(rec1.first.imag()+EPS)][(int)(rec1.first.real()+EPS)]
								&&isExited[(int)(rec1.second.imag()+EPS)][(int)(rec1.second.real()+EPS)]){
									S = max(S,(int)((EPS+abs(v))*(EPS+abs(v))));
								}
						}
				}
				if(abs((double)((int)(rec2.first.imag()+EPS))-rec2.first.imag()) < 0.0000001
					&&abs((double)((int)(rec2.first.real()+EPS))-rec2.first.real()) < 0.0000001
					&&abs((double)((int)(rec2.second.imag()+EPS))-rec2.second.imag()) < 0.0000001
					&&abs((double)((int)(rec2.second.real()+EPS))-rec2.second.real()) < 0.0000001){
						if((int)(rec2.first.imag()+EPS)>=0&&(int)(rec2.first.imag()+EPS)<=5000
							&&(int)(rec2.second.imag()+EPS)>=0&&(int)(rec2.second.imag()+EPS)<=5000
							&&(int)(rec2.first.real()+EPS)>=0&&(int)(rec2.first.real()+EPS)<=5000
							&&(int)(rec2.second.real()+EPS)>=0&&(int)(rec2.second.real()+EPS)<=5000){
								if(isExited[(int)(rec2.first.imag()+EPS)][(int)(rec2.first.real()+EPS)]
								&&isExited[(int)(rec2.second.imag()+EPS)][(int)(rec2.second.real()+EPS)]){
									S = max(S,(int)((EPS+abs(v)*(EPS+abs(v)))));
								}
						}
				}
			}
		}
		cout<<S<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0