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>
using namespace std;
using ld = long double;
using pld = pair<ld, ld>;
const ld INF = 1e3;

bool comp(pld a, pld b) {
	return a.second < b.second;
}

ld closest_pair(pld *a, int n) {
	if (n <= 1) return INF;
	int m = n / 2;
	ld x = a[m].first;
	ld d = min(closest_pair(a, m), closest_pair(a + m, n - m));
	inplace_merge(a, a + m, a + n, comp);
	vector<pld> b;
	for (int i = 0; i < n; i++) {
		if (abs(a[i].first - x) >= d) continue;
		for (int j = 0; j < (int)b.size(); j++) {
			ld dx = a[i].first - b[b.size() - j - 1].first;
			ld dy = a[i].second - b[b.size() - j - 1].second;
			if (dy >= d) break;
			d = min(d, sqrtl(dx * dx + dy * dy));
		}
		b.push_back(a[i]);
	}
	return d;
}

const int MAX = 1e5;

pld ps[MAX];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> ps[i].first >> ps[i].second;
	}
	sort(ps, ps + n);
	cout << fixed << setprecision(8) << closest_pair(ps, n) << endl;
	return 0;
}