Problem: For given n points in metric space, find the distance of the closest points.

Constraints

* 2 ≤ n ≤ 100,000
* -100 ≤ x, y ≤ 100

Input


n
x0 y0
x1 y1
:
xn-1 yn-1


The first integer n is the number of points.

In the following n lines, the coordinate of the i-th point is given by two real numbers xi and yi. Each value is a real number with at most 6 digits after the decimal point.

Output

Print the distance in a line. The output values should be in a decimal fraction with an error less than 0.000001.

Examples

Input

2
0.0 0.0
1.0 0.0


Output

1.000000


Input

3
0.0 0.0
2.0 0.0
1.0 1.0


Output

1.41421356237

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

struct Point {
  ld x, y;

  Point(ld x = 0, ld y = 0): x(x), y(y) {}

  Point operator + (Point &p) {
    return Point(x + p.x, y + p.y);
  }

  Point operator - (Point &p) {
    return Point(x - p.x, y - p.y);
  }

  Point operator * (ld k) {
    return Point(x * k, y * k);
  }

  Point operator / (ld k) {
    return Point(x / k, y / k);
  }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

ld norm(Point p) {
  return p.x * p.x + p.y * p.y;
}

ld dist(Point p) {
  return sqrt(norm(p));
}

ld dot(Point p1, Point p2) {
  return p1.x * p2.x + p1.y * p2.y;
}

ld cross(Point p1, Point p2) {
  return p1.x * p2.y - p1.y * p2.x;
}

Point rotate(Point p, ld theta) {
  return Point(p.x * cos(theta) - p.y * sin(theta), p.x * sin(theta) + p.y * cos(theta));
}

//1:反時計回り
//-1:時計回り
//2:p2, p0, p1の順で同一直線上
//-2:p0, p1, p2の順
//0:p2が線分p0, p1上
int ccw(Point p0, Point p1, Point p2) {
  Point v1 = p1 - p0, v2 = p2 - p0;
  if (cross(v1, v2) > 0) return 1;
  else if (cross(v1, v2) < 0) return -1;
  else if (dot(v1, v2) < 0) return 2;
  else if (norm(v1) < norm(v2)) return -2;
  else return 0;
}

//線分p1, p2がp3, p4と交差するか
bool intersect(Point p1, Point p2, Point p3, Point p4) {
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

//直線p2-p1と点p3の距離
ld getDistanceLP(Point p1, Point p2, Point p3) {
  return fabs(cross(p2-p1, p3-p1) / dist(p2-p1));
}

//線分s(p2-p1)と点p3の距離
ld getDistanceSP(Point p1, Point p2, Point p3) {
  if (dot(p2-p1, p3-p1) < 0) return dist(p3-p1);
  else if (dot(p1-p2, p3-p2) < 0) return dist(p3-p2);
  else return getDistanceLP(p1, p2, p3);
}

//線分s1(p2-p1)と線分s2(p4-p3)の距離
ld getDistanceTS(Point p1, Point p2, Point p3, Point p4) {
  if (intersect(p1, p2, p3, p4)) return 0;
  ld ans = INF;
  ans = min(ans, getDistanceSP(p1, p2, p3));
  ans = min(ans, getDistanceSP(p1, p2, p4));
  ans = min(ans, getDistanceSP(p3, p4, p1));
  ans = min(ans, getDistanceSP(p3, p4, p2));
  return ans;
}

vector<Point> convex_hull(vector<Point>& ps, int n) {
  sort(ps.begin(), ps.end());
  int k = 0;
  vector<Point> qs(2 * n);
  rep(i, n) {
    while (k > 1 && cross(qs[k - 1] - qs[k - 2], ps[i] - qs[k - 1]) <= 0) k--;
    qs[k++] = ps[i];
  }
  for (int i = n - 2, t = k; i >= 0; i--) {
    while (k > t && (cross(qs[k - 1] - qs[k - 2], ps[i] - qs[k - 1]) <= 0)) k--;
    qs[k++] = ps[i];
  }
  qs.resize(k - 1);
  return qs;
}

//円
struct Circle {
  Point p;
  ld r;

  Circle() {}
  Circle(Point p, ld r): p(p), r(r) {}
};

//２円の交点
vector<Point> getIntersections(Circle c1, Circle c2) {
  ld d = dist(c2.p - c1.p);
  ld rc = (c1.r * c1.r + d * d - c2.r * c2.r) / (2 * d);
  ld rs = sqrt(c1.r * c1.r - rc * rc);
  Point e1 = (c2.p - c1.p) / d;
  Point e2 = rotate(e1, M_PI / 2) * rs;
  Point e3 = rotate(e1, -M_PI / 2) * rs;
  e1 = e1 * rc;
  Point a = c1.p + e1 + e2;
  Point b = c1.p + e1 + e3;
  return {a, b};
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n;
  cin >> n;
  vector<Point> p(n);
  rep(i, n) {
    cin >> p[i].x >> p[i].y;
    p[i] = rotate(p[i], 1);
  }

  sort(p.begin(), p.end());
  ld ans = INF;
  rep(i, n) {
    repr(j, i - 1) {
      if (p[i].x - p[j].x > ans) break;
      chmin(ans, dist(p[i] - p[j]));
    }
  }
  cout << ans << '\n';









  




  
  return 0;
}