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 {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

typedef db T;
const db eps = 1e-8;
int sgn(T x){return (x>eps)-(x<-eps);}
struct P{
    T x,y;
    P(){} P(T x,T y):x(x),y(y){}
    void read(){scanf("%lf%lf",&x,&y);}
    P operator - (const P&b) const {return P(x-b.x,y-b.y);}
    P operator + (const P&b) const {return P(x+b.x,y+b.y);}
    T operator * (const P&b) const {return x*b.x+y*b.y;}
    P operator * (const T&k) const {return P(x*k,y*k);}
    T operator ^ (const P&b) const {return x*b.y-y*b.x;}
    bool operator < (const P&b) const {return sgn(y-b.y)?y<b.y:x<b.x;}
};
T abs(P a){return sqrt(a*a);}

namespace NearestPoints{
    T solve(int l,int r,vector<P>&p){
        if(l == r) return 1e100;
        int m=(l+r)>>1;
        T Xm = p[m].x , lim = min(solve(l,m,p) , solve(m+1,r,p));
        inplace_merge(p.begin()+l,p.begin()+m+1,p.begin()+r+1);
        vector<P> V;
        rep(i,l,r+1) if(fabs(p[i].x - Xm) <= lim) V.pb(p[i]);
        rep(i,0,sz(V)) rep(j,i+1,sz(V)){
            if(fabs(V[j].y - V[i].y) >= lim) break;
            T dis = abs(V[i]-V[j]);
            lim = min(lim,dis);
        }
        return lim;
    }
    T solve(vector<P> A){
        sort(all(A),[&](P a,P b){return a.x<b.x;});
        return solve(0,sz(A)-1,A);
    }
}

int main(){
    int n;scanf("%d",&n);
    vector<P> A;
    rep(i,0,n){
        P p;p.read();
        A.pb(p);
    }
    printf("%.10f\n",NearestPoints::solve(A));
    return 0;
}