#include #include #include #include using namespace std; typedef long long ll; typedef pair P; const int INF = (int)1e9 + 1; int n; ll x[1010], y[1010]; ll d[1010][1010]; class DisjointSet { public: vector rank, p; DisjointSet() {} DisjointSet(int size) { rank.resize(size, 0); p.resize(size, 0); for (int i = 0; i < size; i++) { makeSet(i); } } void makeSet(int x) { p[x] = x; rank[x] = 0; } bool same(int x, int y) { return findSet(x) == findSet(y); } void unite(int x, int y) { link(findSet(x), findSet(y)); } void link(int x, int y) { if (rank[x] > rank[y]) { p[y] = x; } else { p[x] = y; if (rank[x] == rank[y]) { rank[y]++; } } } int findSet(int x) { if (x != p[x]) { p[x] = findSet(p[x]); } return p[x]; } }; bool solve(ll len) { DisjointSet ds = DisjointSet(n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (d[i][j] <= len * len) { ds.unite(i, j); } } } return ds.same(0, n - 1); } int main(void) { cin >> n; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]); } } ll left = 0LL, right = 1e10; while (right - left > 1) { ll mid = (left + right) / 2; if (solve(mid)) { right = mid; } else { left = mid; } } ll ans = left; for (int i = 0; i <= 11; i++) { if (ans % 10 == 0) { if (solve(ans)) break; } ans++; } cout << ans << '\n'; return 0; }