/*Coded by::
**Avinash Tiwary**
**BE/10298/2015**
**Production Engineer**
**Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 50010
#define M5 509
#define M6 2000009
#define M 1000000007
#define inf LLONG_MAX
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
struct point{
ll x,y,id;
};
bool compx(point a, point b) {
return a.x < b.x;
}
bool comp(point a, point b) {
if(a.y!=b.y)return a.y < b.y;
return a.x < b.x;
}
ll dis(point a,point b){
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
ll best_distance,a1,a2;
void merge(point *a,point *aux,ll lo,ll mid,ll hi){
for(ll i=lo;i<=hi;i++) aux[i]=a[i];
ll i=lo,j=mid+1,k=lo;
while(i<=mid&&j<=hi){
if(comp(aux[i],aux[j])){
a[k++]=aux[i++];
}
else a[k++]=aux[j++];
}
while(i<=mid) a[k++]=aux[i++];
//while(j<=hi) a[k++]=aux[j++];
}
ll clop(point *px,point *py,point *aux,ll lo,ll hi){
if(hi<=lo) return inf;
ll mid=lo+(hi-lo)/2;
ll d1=clop(px,py,aux,lo,mid);
ll d2=clop(px,py,aux,mid+1,hi);
d1=min(d1,d2);
merge(py,aux,lo,mid,hi);
ll j=0;
for(ll i=lo;i<=hi;i++){
if(abs(py[i].x-px[mid].x)<d1) aux[j++]=py[i];
}
for(ll i=0;i<j-1;i++){
for(ll k=i+1;k<j&&aux[k].y-aux[i].y<d1;k++){
if(dis(aux[i],aux[k])<d1){
d1=dis(aux[i],aux[k]);
if(d1<best_distance){
best_distance=d1;
a1=min(aux[i].id,aux[k].id);
a2=max(aux[i].id,aux[k].id);
}
}
}
}
return d1;
}
int main(){
buf;
//sieve();
//fact();
ll i,j,k,test,flag,ans,t,n,m,a,b,c; string s1;
//cin>>test;
//test=1;
t=1;
while(t){
cin>>n;
if(n==0) break;
point *px,*py,*aux;
px= new point[n];
for(i=0;i<n;i++) {cin>>px[i].x>>px[i].y; px[i].id=i;}
py= new point[n];
sort(px,px+n,compx);
for(i=0;i<n;i++) py[i]=px[i];
best_distance=inf;
aux= new point[n];
clop(px,py,aux,0,n-1);
if(best_distance>=100000000) cout<<"INFINITY\n";
else cout<<fixed<<setprecision(4)<<sqrt(best_distance*1.0)<<"\n";
delete(px); delete(py); delete(aux);
t++;
}
return 0;
}
LypDb2RlZCBieTo6CiAgICAqKkF2aW5hc2ggVGl3YXJ5KioKICAgICoqQkUvMTAyOTgvMjAxNSoqCiAgICAqKlByb2R1Y3Rpb24gRW5naW5lZXIqKgogICAgKipQcm9kdWNpbmcgPGNvZGU+KioKKi8KI2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBidWYgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyAoMCksIGNpbi50aWUgKDApCnR5cGVkZWYgbG9uZyBsb25nIGxsOwp0eXBlZGVmIGRvdWJsZSBkb2I7CiNkZWZpbmUgTUFYIDUwMDEwCiNkZWZpbmUgTTUgNTA5CiNkZWZpbmUgTTYgMjAwMDAwOQojZGVmaW5lIE0gMTAwMDAwMDAwNwojZGVmaW5lIGluZiBMTE9OR19NQVgKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiB2ZWN0b3I8bGw+IFY7CnR5cGVkZWYgcXVldWU8bGwgPiBROwp0eXBlZGVmIHN0YWNrPGxsPiBTOwp0eXBlZGVmIHBhaXI8bGwsbGw+IFA7CiNkZWZpbmUgRiBmaXJzdAojZGVmaW5lIFMgc2Vjb25kCiNkZWZpbmUgbXAgbWFrZV9wYWlyCiNkZWZpbmUgbXQgbWFrZV90dXBsZQojZGVmaW5lIHBiIHB1c2hfYmFjawpzdHJ1Y3QgcG9pbnR7CiAgICBsbCB4LHksaWQ7Cn07CmJvb2wgY29tcHgocG9pbnQgYSwgcG9pbnQgYikgIHsKICAgIHJldHVybiBhLnggPCBiLng7Cn0KYm9vbCBjb21wKHBvaW50IGEsIHBvaW50IGIpIHsKICAgIGlmKGEueSE9Yi55KXJldHVybiBhLnkgPCBiLnk7CiAgICByZXR1cm4gYS54IDwgYi54Owp9CmxsIGRpcyhwb2ludCBhLHBvaW50IGIpewogICAgcmV0dXJuIChhLngtYi54KSooYS54LWIueCkrKGEueS1iLnkpKihhLnktYi55KTsKfQpsbCBiZXN0X2Rpc3RhbmNlLGExLGEyOwp2b2lkIG1lcmdlKHBvaW50ICphLHBvaW50ICphdXgsbGwgbG8sbGwgbWlkLGxsIGhpKXsKICAgIGZvcihsbCBpPWxvO2k8PWhpO2krKykgYXV4W2ldPWFbaV07CiAgICBsbCBpPWxvLGo9bWlkKzEsaz1sbzsKICAgIHdoaWxlKGk8PW1pZCYmajw9aGkpewogICAgICAgIGlmKGNvbXAoYXV4W2ldLGF1eFtqXSkpewogICAgICAgICAgICBhW2srK109YXV4W2krK107CiAgICAgICAgfQogICAgICAgIGVsc2UgYVtrKytdPWF1eFtqKytdOyAKICAgIH0KICAgIHdoaWxlKGk8PW1pZCkgYVtrKytdPWF1eFtpKytdOwogICAgLy93aGlsZShqPD1oaSkgYVtrKytdPWF1eFtqKytdOwp9CmxsIGNsb3AocG9pbnQgKnB4LHBvaW50ICpweSxwb2ludCAqYXV4LGxsIGxvLGxsIGhpKXsKICAgIGlmKGhpPD1sbykgcmV0dXJuIGluZjsKICAgIGxsIG1pZD1sbysoaGktbG8pLzI7CiAgICBsbCBkMT1jbG9wKHB4LHB5LGF1eCxsbyxtaWQpOwogICAgbGwgZDI9Y2xvcChweCxweSxhdXgsbWlkKzEsaGkpOwogICAgZDE9bWluKGQxLGQyKTsKICAgIG1lcmdlKHB5LGF1eCxsbyxtaWQsaGkpOwogICAgbGwgaj0wOwogICAgZm9yKGxsIGk9bG87aTw9aGk7aSsrKXsKICAgICAgICBpZihhYnMocHlbaV0ueC1weFttaWRdLngpPGQxKSBhdXhbaisrXT1weVtpXTsKICAgIH0KICAgIGZvcihsbCBpPTA7aTxqLTE7aSsrKXsKICAgICAgICBmb3IobGwgaz1pKzE7azxqJiZhdXhba10ueS1hdXhbaV0ueTxkMTtrKyspewogICAgICAgICAgICBpZihkaXMoYXV4W2ldLGF1eFtrXSk8ZDEpewogICAgICAgICAgICAgICAgZDE9ZGlzKGF1eFtpXSxhdXhba10pOwogICAgICAgICAgICAgICAgaWYoZDE8YmVzdF9kaXN0YW5jZSl7CiAgICAgICAgICAgICAgICAgICAgYmVzdF9kaXN0YW5jZT1kMTsKICAgICAgICAgICAgICAgICAgICBhMT1taW4oYXV4W2ldLmlkLGF1eFtrXS5pZCk7CiAgICAgICAgICAgICAgICAgICAgYTI9bWF4KGF1eFtpXS5pZCxhdXhba10uaWQpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIGQxOwp9CmludCBtYWluKCl7CiAgICBidWY7IAogICAgLy9zaWV2ZSgpOyAKICAgIC8vZmFjdCgpOwogICAgbGwgaSxqLGssdGVzdCxmbGFnLGFucyx0LG4sbSxhLGIsYzsgc3RyaW5nIHMxOwogICAgLy9jaW4+PnRlc3Q7CiAgICAvL3Rlc3Q9MTsKICAgIHQ9MTsKICAgIHdoaWxlKHQpewogICAgICAgIGNpbj4+bjsKICAgICAgICBpZihuPT0wKSBicmVhazsKICAgICAgICBwb2ludCAqcHgsKnB5LCphdXg7CiAgICAgICAgcHg9IG5ldyBwb2ludFtuXTsKICAgICAgICBmb3IoaT0wO2k8bjtpKyspIHtjaW4+PnB4W2ldLng+PnB4W2ldLnk7IHB4W2ldLmlkPWk7fQogICAgICAgIHB5PSBuZXcgcG9pbnRbbl07CiAgICAgICAgc29ydChweCxweCtuLGNvbXB4KTsKICAgICAgICBmb3IoaT0wO2k8bjtpKyspIHB5W2ldPXB4W2ldOwogICAgICAgIGJlc3RfZGlzdGFuY2U9aW5mOwogICAgICAgIGF1eD0gbmV3IHBvaW50W25dOwogICAgICAgIGNsb3AocHgscHksYXV4LDAsbi0xKTsKICAgICAgICBpZihiZXN0X2Rpc3RhbmNlPj0xMDAwMDAwMDApIGNvdXQ8PCJJTkZJTklUWVxuIjsKICAgICAgICBlbHNlIGNvdXQ8PGZpeGVkPDxzZXRwcmVjaXNpb24oNCk8PHNxcnQoYmVzdF9kaXN0YW5jZSoxLjApPDwiXG4iOwogICAgICAgIGRlbGV0ZShweCk7IGRlbGV0ZShweSk7IGRlbGV0ZShhdXgpOwogICAgICAgIHQrKzsKICAgIH0KICAgIHJldHVybiAwOwp9IA==