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 PYTHON3):

Solution:
# -*- coding: utf-8 -*-
"""
Closest Pair
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_5_A&lang=ja
TLE
"""
import sys


from collections import deque
def closest_pair(points):
    return find_closest(sorted(points)) ** 0.5

def find_closest(points):
    n = len(points)
    if n <= 1:
        return float('inf')
    m = n // 2
    x = points[m][0]
    d = min(find_closest(points[:m]),  find_closest(points[m:]))
    points.sort(key=lambda p:p[1])
    b = deque()
    for p in points:
        if (p[0] - x)**2 < d:
            for q in b:
                dx = p[0] - q[0]
                dy = p[1] - q[1]
                if dy**2 >= d:
                    break
                if (dx**2 + dy**2) < d:
                    d = (dx**2 + dy**2)
            b.appendleft(p)
    return d


def main(args):
    n = int(input())
    points = []
    for _ in range(n):
        x, y = map(float, input().split())
        points.append((x, y))
    ans = closest_pair(sorted(points))
    print('{:.10f}'.format(ans))


if __name__ == '__main__':
    main(sys.argv[1:])