/// USACO 2016 December Contest, Gold - Moocast
/// https://u...content-available-to-author-only...o.org/index.php?page=viewproblem2&cpid=669
/// Author: Qwerty
#include<bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;
const int MAXN = 1010;
pair<int, int> c[MAXN];
vector<pair<int, pair<int, int>>> edge;
int n;
struct DSU{
int parent[MAXN];
DSU(){
for (int i = 1; i <= n; i++){
parent[i] = i;
}
}
int find(int u){
if (parent[u] != u) return parent[u] = find(parent[u]);
return parent[u];
}
bool unite(int u, int v){
u = find(u);
v = find(v);
if (u == v) return false;
parent[u] = v;
return true;
}
};
int dist(pair<int, int> &a, pair<int, int> &b){
return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second);
}
int main(){
//freopen("moocast.in", "r", stdin);
//freopen("moocast.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++){
cin >> c[i].first >> c[i].second;
}
for (int i = 1; i <= n; i++){
for (int j = i + 1; j <= n; j++){
edge.push_back({dist(c[i], c[j]), {i, j}});
}
}
sort(edge.begin(), edge.end());
DSU s;
int cnt = 0;
int ans = 0;
for (auto e: edge){
int w = e.fi;
int u = e.se.fi;
int v = e.se.se;
if (s.unite(u, v)){
ans = max(ans, w);
cnt++;
}
if (cnt == n - 1){
break;
}
}
cout << ans << '\n';
}
Ly8vIFVTQUNPIDIwMTYgRGVjZW1iZXIgQ29udGVzdCwgR29sZCAtIE1vb2Nhc3QKLy8vIGh0dHBzOi8vdS4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uby5vcmcvaW5kZXgucGhwP3BhZ2U9dmlld3Byb2JsZW0yJmNwaWQ9NjY5Ci8vLyBBdXRob3I6IFF3ZXJ0eQojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgc2Ugc2Vjb25kCiNkZWZpbmUgbGwgbG9uZyBsb25nCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBNQVhOID0gMTAxMDsKcGFpcjxpbnQsIGludD4gY1tNQVhOXTsKdmVjdG9yPHBhaXI8aW50LCBwYWlyPGludCwgaW50Pj4+IGVkZ2U7CmludCBuOwpzdHJ1Y3QgRFNVewogICAgaW50IHBhcmVudFtNQVhOXTsKICAgIERTVSgpewogICAgICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkrKyl7CiAgICAgICAgICAgICBwYXJlbnRbaV0gPSBpOwogICAgICAgIH0KICAgIH0KICAgIGludCBmaW5kKGludCB1KXsKICAgICAgICBpZiAocGFyZW50W3VdICE9IHUpIHJldHVybiBwYXJlbnRbdV0gPSBmaW5kKHBhcmVudFt1XSk7CiAgICAgICAgcmV0dXJuIHBhcmVudFt1XTsKICAgIH0KICAgIGJvb2wgdW5pdGUoaW50IHUsIGludCB2KXsKICAgICAgICB1ID0gZmluZCh1KTsKICAgICAgICB2ID0gZmluZCh2KTsKICAgICAgICBpZiAodSA9PSB2KSByZXR1cm4gZmFsc2U7CiAgICAgICAgcGFyZW50W3VdID0gdjsKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KfTsKaW50IGRpc3QocGFpcjxpbnQsIGludD4gJmEsIHBhaXI8aW50LCBpbnQ+ICZiKXsKICAgIHJldHVybiAoYS5maXJzdCAtIGIuZmlyc3QpICogKGEuZmlyc3QgLSBiLmZpcnN0KSArIChhLnNlY29uZCAtIGIuc2Vjb25kKSAqIChhLnNlY29uZCAtIGIuc2Vjb25kKTsKfQppbnQgbWFpbigpewogICAgLy9mcmVvcGVuKCJtb29jYXN0LmluIiwgInIiLCBzdGRpbik7CiAgICAvL2ZyZW9wZW4oIm1vb2Nhc3Qub3V0IiwgInciLCBzdGRvdXQpOwogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbi50aWUoMCk7CiAgICBjaW4gPj4gbjsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkrKyl7CiAgICAgICAgIGNpbiA+PiBjW2ldLmZpcnN0ID4+IGNbaV0uc2Vjb25kOwogICAgfQogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKXsKICAgICAgICAgZm9yIChpbnQgaiA9IGkgKyAxOyBqIDw9IG47IGorKyl7CiAgICAgICAgICAgICAgZWRnZS5wdXNoX2JhY2soe2Rpc3QoY1tpXSwgY1tqXSksIHtpLCBqfX0pOwogICAgICAgICB9CiAgICB9CiAgICBzb3J0KGVkZ2UuYmVnaW4oKSwgZWRnZS5lbmQoKSk7CiAgICBEU1UgczsKICAgIGludCBjbnQgPSAwOwogICAgaW50IGFucyA9IDA7CiAgICBmb3IgKGF1dG8gZTogZWRnZSl7CiAgICAgICAgaW50IHcgPSBlLmZpOwogICAgICAgIGludCB1ID0gZS5zZS5maTsKICAgICAgICBpbnQgdiA9IGUuc2Uuc2U7CiAgICAgICAgaWYgKHMudW5pdGUodSwgdikpewogICAgICAgICAgICBhbnMgPSBtYXgoYW5zLCB3KTsKICAgICAgICAgICAgY250Kys7CiAgICAgICAgfQogICAgICAgIGlmIChjbnQgPT0gbiAtIDEpewogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICB9CiAgICBjb3V0IDw8IGFucyA8PCAnXG4nOwp9Cg==