#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<pair<int, int> > p(n);
        for(int i=0; i<n; ++i)
            cin >> p[i].first >> p[i].second;
        sort(p.begin(), p.end());

        int ret = 0;
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                int x = p[j].first - p[i].first;
                int y = p[j].second - p[i].second;
                pair<int, int> p1(p[i].first + y, p[i].second - x);
                pair<int, int> p2(p[j].first + y, p[j].second - x);
                if(binary_search(p.begin(), p.end(), p1) && binary_search(p.begin(), p.end(), p2))
                    ret = max(ret, x*x + y*y);
            }
        }
        cout << ret << endl;
    }
}