#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
#define x first
#define y second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(n) n.begin(),n.end()
int main(){
	int n;
	
	while(cin >> n,n){		
		int ret = 0;
		
		vector<P> data;
		rep(i,n){
			P t;
			cin >> t.x >> t.y;
			data.push_back(t);
		}
		sort(all(data));
		
		rep(i,n){
			rep(j,n){
				if(i == j)continue;
				
				P dis;
				dis.x = data[i].x - data[j].x;
				dis.y = data[i].y - data[j].y;
				
				P tg1,tg2;
							
				tg1.x = data[i].x - dis.y;
				tg1.y = data[i].y + dis.x;
				
				tg2.x = data[j].x - dis.y;
				tg2.y = data[j].y + dis.x;
				
				if(binary_search(all(data),tg1) && binary_search(all(data),tg2)){
					ret = max(ret,dis.x * dis.x + dis.y * dis.y);
				}
			}
		}
		cout << ret << endl;
	}
	
}
	