#include <iostream>
#include <set>

using namespace std;
typedef pair<int, int> P;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		set<P> Set;
		for(int i = 0; i < n; ++i)
		{
			int x, y;
			cin >> x >> y;
			Set.insert(P(x, y));
		}
		int ans = 0;
		for(set<P>::iterator It = Set.begin(); It != Set.end(); ++It)
		{
			for(set<P>::iterator It2 = Set.begin(); It2 != Set.end(); ++It2)
			{
				int tx = It->first - It2->first;
				int ty = It->second - It2->second;
				if(tx * tx + ty * ty <= ans)
				{
					continue;
				}
				if(Set.count(P(It->first - ty, It->second + tx)) && Set.count(P(It2->first - ty, It2->second + tx)))
				{
					ans = tx * tx + ty * ty;
				}
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}