#include using namespace std; struct node { node(long long xi, long long yi):x(xi) { y.insert(yi); } long long x; mutable set y; long long operator < (node a) const{ return x < a.x; } }; int main () { ios::sync_with_stdio(false); set < node > graph; long long n; while ( cin >> n ) { long long m = 0; for ( long long j = 0; j < n; ++j ) { long long x, y; cin >> x >> y; auto i = graph.find(node(x,0)) ; if ( i == graph.end() ) { graph.insert(node(x, y)); } else { i -> y.insert(y); } } for ( auto i : graph ) { if ( i . y.size() == 1 ) continue; for ( set::iterator j = i.y.begin(); j != i.y.end(); ++j ) { for ( set::iterator k = j; k != i . y.end(); ++k ) { long long dif = *k - *j; node tmp(i . x + dif, 0); set::iterator right = graph.find(tmp); if ( right -> x <= i.x ) continue; if ( right -> y.find(*k) != right -> y.end() && right -> y.find(*j) != right -> y.end() ) { m = max ( m , dif ); } } } } cout << m << endl; } return 0; }