#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60


/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0518>
 ?????????============================================================
 ???, ???????????????????????????, ?????????????????????????????????. ???????????¢?????§??????????§?????????????????????????.
 ??????, ??????????????????????????¢?????±??????, ????????¨, ???????????????????????£?????±????????????????????????????????\????????????????????£???.
 ?????????????\????????¨???°?????????. ?\????????????????????????¨??£?¢??????£?????¢????????£?????????, ????????????????????±????????£???.
 ?\??????????????????????????????????????????????????????????. ??????, ??????????????¨?????±????????£?????????????????????????????????.
 ?????????????????????, ???????????????????????£?????±????????§, ??£?????¢????????£????????????????????????,
 ??¢???????????§?????????????\?????????????????????¨?????????.
 
 ??±??????????????§?¨????????????????????????§, 4 ??¬?????±??§??§????????£?????¢???????????¢???????????§??????????????¢???,
 ????????¢??????????????????????????°???????????????. ??????, ??£?????¢???????????§?¨???????????????¨????????????????????¨?????¨?????????.
 
 =================================================================
 ?§£??¬=============================================================
 ????´???????????????£?????¢????????£????????????????¬??????¢?´¢????????¨O(n^4)??¨????????????????????????
 ??£?????¢?????§??????, ??????2??????????????¨????????°?????????2???(????§°??§??????????????°?????????2???)????????????????????????
 ??¨????????°?????¨???????????????2??????????????°???????????§O(n^2)
 ?????????????¨?????????????2??????????????????????????¨???????¢??????????????????¢?´¢(O(log n))???????????¨??¶?´???????
 ?????????????????????????????§???hash?????¨??????O(1)??§?¢??????????
 ?????????hash????????????????????????????????¨MLE??¨???????????§??¨???
 ================================================================
 */

pll ps[3001];
bool m[5001][5001];

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    while(cin >> N, N){
        for(int i = 0; i < 5001;i++)for(int j = 0; j < 5001;j++) m[i][j] = false;
        for(int i = 0; i < N; i++){
            cin >> ps[i].first >> ps[i].second;
            m[ps[i].first][ps[i].second] = true;
        }
        ll res = 0;
        for(int i = 0; i < N;i++){
            for(int j = i+1;j <N;j++){
                ll x1 = ps[i].first,y1 = ps[i].second,x2 = ps[j].first,y2 = ps[j].second;
                
                ll area = (x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1);
                if(area <= res) continue;
                ll x3 = x1 + (y1 - y2),y3 = y1 + (x2 - x1);
                if(x3 >= 0 && x3 <= 5000 && y3 >= 0 && y3 <= 5000){
                    if(m[x3][y3]){
                        ll x4 = x2 + (x3 - x1), y4 = y2 + (y3 - y1);
                        if(x4 >= 0 && x4 <= 5000 && y4 >= 0 && y4 <= 5000){
                            if(m[x4][y4]){
                                res = area;
                                continue;
                            }
                        }
                    }
                }
                x3 = x1 - (y1 - y2), y3 = y1 - (x2 - x1);
                if(x3 >= 0 && x3 <= 5000 && y3 >= 0 && y3 <= 5000){
                    if(m[x3][y3]){
                        ll x4 = x2 + (x3 - x1), y4 = y2 + (y3 - y1);
                        if(x4 >= 0 && x4 <= 5000 && y4 >= 0 && y4 <= 5000){
                            if(m[x4][y4]){
                                res = area;
                                continue;
                            }
                        }
                    }
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 27592