#include <iostream>
#include <set>

using namespace std;

inline int abs(int a){ return a >= 0 ? a : -a; }

typedef pair<int, int> pii;

class MyComparator {
public:
	bool operator()(pii &a, pii &b){
		if(a.first < b.first){ return true; }
		if(a.first > b.first){ return false; }
		return a.second < b.second;
	}
};

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		set<pii> field;
		while(n--){
			int x, y;
			cin >> x >> y;
			field.insert(pii(x, y));
		}
		int answer = 0;
		for(set<pii>::iterator i = field.begin(); i != field.end();){
			pii p1 = *i;
			for(set<pii>::iterator j = ++i; j != field.end(); j++){
				pii p2 = *j;
				int dx = abs(p1.first - p2.first), dy = abs(p1.second - p2.second);
				int size = dx * dy * 2 + (dx - dy) * (dx - dy);
				if(size > answer){
					if(
						field.find(pii(p1.first - dy, p1.second - dx)) != field.end() &&
						field.find(pii(p2.first - dy, p2.second - dx)) != field.end()
					){
						answer = size;
					}else if(
						field.find(pii(p1.first + dy, p1.second + dx)) != field.end() &&
						field.find(pii(p2.first + dy, p2.second + dx)) != field.end()
					){
						answer = size;
					}
				}
			}
		}
		printf("%d\n", answer);
	}
	return 0;
}