#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;
 
P h[3000];
int main() {
    int n;
    while (scanf("%d", &n), n) {
        rep(i, n)scanf("%d%d", &h[i].first, &h[i].second);
        sort(h, h + n);
        int Max = 0;
        rep(i, n) {
            for (int j = i + 1; j < n; j++) {
                int x = h[j].first - h[i].first,
                    y = abs(h[j].second - h[i].second);
                if (!x)continue;
                P a = { h[i].first,h[i].second + x },
                    b = { h[j].first,h[j].second + x };
                if (h[i].second < h[j].second) {
                    a.first -= y; b.first -= y;
                }
                else {
                    a.first += y; b.first += y;
                }
                if (binary_search(h, h + n, a) && binary_search(h, h + n, b))
                    Max = max(Max, (x + y)*(x + y) - x*y * 2);
            }
        }
        printf("%d\n", Max);
    }
    return 0;
}