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
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
struct Point {
    double x, y;
    bool operator < (const Point& p) const {
        if(x != p.x) return x < p.x;
        return y < p.y;
    }
};


double dist(double x, double y){
    return sqrt(x * x + y * y);
}
double dist(Point p, Point q){
    return dist(p.x - q.x, p.y - q.y);
}

int main(){
    int N;
    cin >> N;
    vector<Point> ps(N);
    REP(i, N){
        double x, y;
        scanf("%lf %lf", &ps[i].x, &ps[i].y);
    }
    sort(ps.begin(), ps.end());
    double ans = dist(ps[0], ps[1]);
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N && ps[j].x - ps[i].x < ans; j++){
            ans = min(ans, dist(ps[i], ps[j]));
        }
    }
    printf("%.12f\n", ans);
    return 0;
}