using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static int n;
	static double d=double.MaxValue;
	static void Main(){
		Sc sc=new Sc();
		n=sc.I;
		var px=new Pair[n];
		var py=new Pair[n];
		for(int i = 0;i<n;i++) {
			var e=sc.Da;
			px[i]=new Pair(e[0],e[1]);
			py[i]=new Pair(e[0],e[1]);
		}
		Array.Sort(px,(u,v)=>{var c=u.x.CompareTo(v.x);return c==0?u.y.CompareTo(v.y):c;});
		Array.Sort(py,(u,v)=>{var c=u.y.CompareTo(v.y);return c==0?u.x.CompareTo(v.x):c;});
		Fu(px,py);
		Console.WriteLine("{0:n10}",d);
	}
	static void Fu(Pair[] px,Pair[] py){
		int l=px.Length>>1;
		if(px.Length<=3){
			d=Min(d,Fdc(px[0],px[1]));
			if(px.Length==3){d=Min(d,Min(Fdc(px[0],px[2]),Fdc(px[1],px[2])));}
			return;
		}
		var kx1=new Pair[l];
		var ky1=new Pair[l];
		var kx2=new Pair[px.Length-l];
		var ky2=new Pair[px.Length-l];
		for(int i = 0,j1=0,j2=0;i<px.Length;i++) {
			if(i<kx1.Length){kx1[i]=px[i];}
			else{kx2[i-kx1.Length]=px[i];}
			if(py[i].x<px[l].x||(py[i].x==px[l].x&&py[i].y<px[l].y)){ky1[j1]=py[i];j1++;}
			else{ky2[j2]=py[i];j2++;}
		}
		Fu(kx1,ky1);
		Fu(kx2,ky2);
		var li=new List<Pair>();
		for(int i = 0;i<py.Length;i++) {
			if(Abs(py[i].x-px[l].x)<=d){li.Add(py[i]);}
		}
		for(int i = 0;i<li.Count;i++) {
			for(int j = i+1;j<i+8&&j<li.Count;j++) {d=Min(d,Fdc(li[i],li[j]));}
		}
	}
	static double Fdc(Pair a,Pair b){return Sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
}
public struct Pair{
	public double x,y;
	public Pair(double x,double y){this.x=x;this.y=y;}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


Measured memory_bytes: 48152