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 <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

template<class T>
struct Vec2
{
	Vec2(){}
	Vec2(T _x, T _y) : x(_x), y(_y) {}

	Vec2 operator+(const Vec2& rhs) const { return Vec2(x + rhs.x, y + rhs.y); }
	Vec2 operator-(const Vec2& rhs) const { return Vec2(x - rhs.x, y - rhs.y); }
	T sqlength() const { return x*x + y*y; }
	bool operator<(const Vec2& rhs) const {
		return x < rhs.x;
	}

	T x, y;
};

typedef Vec2<double> Vec;
typedef long long ll;

static int Rand()
{
	static int r = 123456789;
	r = r ^ (r << 13);
	r = r ^ (r >> 17);
	r = r ^ (r << 5);
	return r;
}

int main()
{
	int n = 0;
	cin >> n;

	const double xs = Rand() % 1000, ys = Rand() % 1000;

	vector<Vec> P;
	P.reserve(n);
	for (int i = 0; i < n; i++) {
		double x, y;
		scanf("%lf%lf", &x, &y);
		P.push_back(Vec(x*xs-y*ys, x*ys+y*xs));
	}
	sort(P.begin(), P.end());

	double ans = HUGE_VAL;
	for (size_t i = 0; i < P.size(); i++) {
		double mindsq = HUGE_VAL;
		for (size_t j = i + 1; j < P.size(); j++) {
			if (P[i].x + ans < P[j].x) break;
			double dsq = (P[i] - P[j]).sqlength();
			mindsq = min(mindsq, dsq);
		}
		ans = min(ans, sqrt(mindsq));
	}

	printf("%.10f\n", ans/hypot(xs,ys));
	return 0;
}