#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout(n) cout << fixed << setprecision(n)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acosl(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


struct Point {
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y){}
    friend ostream& operator<<(ostream& os, const Point& p){ return os << '(' << p.x << ", " << p.y << ')'; }
};
inline Point operator+(const Point& p, const Point& q){ return Point(p.x+q.x, p.y+q.y); }
inline Point operator-(const Point& p, const Point& q){ return Point(p.x-q.x, p.y-q.y); }
inline Point operator*(const Point& p, double a){ return Point(p.x*a, p.y*a); }
inline Point operator*(double a, const Point& p){ return Point(a*p.x, a*p.y); }
inline Point operator / (const Point& p, double a){ return Point(p.x/a, p.y/a); }
inline Point conj(const Point& p){ return Point(p.x, -p.y); }
inline Point rot(const Point& p, double ang){ return Point(cos(ang)*p.x-sin(ang)*p.y, sin(ang)*p.x+cos(ang)*p.y); }
inline Point rot90(const Point& p){ return Point(-p.y, p.x); }
inline double cross(const Point& p, const Point& q){ return p.x*q.y-p.y*q.x; }
inline double dot(const Point& p, const Point& q){ return p.x*q.x+p.y*q.y; }
inline double norm(const Point& p){ return p.x*p.x+p.y*p.y; }
inline double abs(const Point& p){ return sqrtl(norm(p)); }
inline double amp(const Point& p){ double res = atan2(p.y, p.x); if(res < 0) res+=PI*2; return res; }
inline bool eq(const Point& p, const Point& q){ return abs(p-q) < EPS; }
inline bool operator<(const Point& p, const Point& q){ return (abs(p.x-q.x) > EPS ? p.x < q.x : p.y < q.y); }
inline bool operator>(const Point &p, const Point &q){ return (abs(p.x-q.x) > EPS ? p.x > q.x : p.y > q.y); }


signed main(){
    int n;
    while(cin >> n, n){
        vector<Point> v(n);
        vector<vector<bool>> f(5010, vector<bool>(5010));
        rep(i, 0, n){
            cin >> v[i].x >> v[i].y;
            f[v[i].x][v[i].y] = true;
        }
        int ans = 0;
        rep(i, 0, n) rep(j, i+1, n){
            auto a = v[i]+rot90(v[j]-v[i]);
            auto b = v[j]+rot90(v[j]-v[i]);
            int s = norm(v[j]-v[i]);
            if(isin(a.x, 0, 5010) and isin(a.y, 0, 5010) and isin(b.x, 0, 5010) and isin(b.y, 0, 5010) and f[a.x][a.y] and f[b.x][b.y]) chmax(ans, s);
            a = v[j]+rot90(v[i]-v[j]);
            b = v[i]+rot90(v[i]-v[j]);
            if(isin(a.x, 0, 5010) and isin(a.y, 0, 5010) and isin(b.x, 0, 5010) and isin(b.y, 0, 5010) and f[a.x][a.y] and f[b.x][b.y]) chmax(ans, s);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 6408