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 <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
typedef pair<double, double> P;

int n;
pair<double ,double> p[100000];

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
	
	//random rotate
	double rad = 0.364364334 * 3.14159265358979;
	for (i = 0; i < n; i++) {
		double x = p[i].first * cos(rad) - p[i].second * sin(rad);
		double y = p[i].first * sin(rad) + p[i].second * cos(rad);
		p[i].first = x;
		p[i].second = y;
	}
	
	sort(p, p + n);
	
	double minDist2 = 1145141919;
	
	for (i = 0; i < n; i++) {
		for (j = i - 1; j >= 0; j--) {
			double dx = p[i].first - p[j].first;
			double dy = p[i].second - p[j].second;
			double dist = dx * dx + dy * dy;
			
			if (dx * dx >= minDist2) break;
			
			minDist2 = min(minDist2, dist);
		}
	}
	
	printf("%.14f\n", sqrt(minDist2));
	return 0;
}