#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid-1),d2=dfs(mid,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,ans.b.k);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
int X[6]={0,1,-1,1,-1};
int Y[6]={0,1,1,-1,-1};
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                tmp.x=p[ne].x*X[i];
                tmp.y=p[ne].y*Y[i];
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1,m=n;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
        nod ans=dfs(1,n);
        point a,b;
        bool ck=0;

        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
//    printf("(%d) %d %d ",a.id,a.x,a.y);
//    printf("(%d) %d %d ",b.id,b.x,b.y);
//    cout<<(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)<<endl;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
//    cout<<l<<" "<<r<<endl;
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
     if( l+2 == r )
     {
        if (d.len>dis(p[l],p[l+1]))
        {
            d.a=p[l];
            d.b=p[l+1];
            d.len=dis(p[l],p[l+1]);
        }
        if (d.len>dis(p[l+1],p[r]))
        {
            d.a=p[l+1];
            d.b=p[r];
            d.len=dis(p[l+1],p[r]);
        }
        if (d.len>dis(p[l],p[r]))
        {
            d.a=p[l];
            d.b=p[r];
            d.len=dis(p[l],p[r]);
        }
        return d;
     }

    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            if (a<0)
            {
                if (b<0)
                    tmp.k=4;
                else
                    tmp.k=2;
            }
            else
            {
                if (b<0)
                    tmp.k=3;
                else
                    tmp.k=1;
            }
            tmp.x=tx;
            tmp.y=ty;
            tmp.id=i;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
//        int cnt=n+1;
//        for (i=1;i<=n;i++)
//        {
//            point tmp=p[i];
//            tmp=p[i];
//            tmp.k=1;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=2;
//            tmp.x=-p[i].x;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=3;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=4;
//            tmp.x=-p[i].x;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//        }
//        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        int x=ans.a.id,y=ans.b.id;
//        printf("%d\n",ans.len);
        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,5-ans.b.k);
    }
    return 0;
}
//#include <vector>
//#include <list>
//#include <map>
//#include <set>
//#include <deque>
//#include <queue>
//#include <stack>
//#include <bitset>
//#include <algorithm>
//#include <functional>
//#include <numeric>
//#include <utility>
//#include <complex>
//#include <sstream>
//#include <iostream>
//#include <iomanip>
//#include <cstdio>
//#include <cmath>
//#include <cstdlib>
//#include <cstring>
//#include <ctime>
//#include <cassert>
//using namespace std;
//
//#define maxn 100005
//
//int x[maxn],y[maxn],id[maxn],now[maxn],op[maxn];
//int ans,ansi,ansj,n;
//
//inline bool cmpx(const int &i,const int &j)
//{
//    return x[i]<x[j];
//}
//
//inline bool cmpy(const int &i,const int &j)
//{
//    return y[i]<y[j];
//}
//
//inline void Update(int i,int j)
//{
//    int t=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
//    if (t<ans){
//        ans=t;
//        ansi=i;
//        ansj=j;
//    }
//}
//
//inline void solve(int l,int r)
//{
//    if (r-l<3){
//        for (int i=l;i<=r;++i)
//            for (int j=i+1;j<=r;++j)
//                Update(id[i],id[j]);
//        return;
//    }
//
//    int mid=(l+r)>>1;
//    solve(l,mid);
//    solve(mid+1,r);
//
//    double len=sqrt((double)ans);
//    int N=0;
//    int xx=id[mid];
//    for (int i=l;i<=r;++i){
//        int u=id[i];
//        if (fabs(x[u]-x[xx])<=len){
//            now[N++]=u;
//        }
//    }
////  puts("----------------------");
//    sort(now,now+N,cmpy);
//    for (int i=0,j=0;i<N;++i){
//        while (j<N && y[now[j]]-y[now[i]]<=len) ++j;
//        for (int a=i;a<j;++a)
//            for (int b=a+1;b<j;++b)
//                Update(now[a],now[b]);
//    }
//}
//
//int main()
//{
////    freopen("input.txt","r",stdin);
////    freopen("output.txt","w",stdout);
//
//    scanf("%d",&n);
//    for (int i=0;i<n;++i){
//        scanf("%d%d",&x[i],&y[i]);
//        if (x[i]<0){
//            if (y[i]<0){
//                op[i]=4;
//            }else{
//                op[i]=2;
//            }
//        }else{
//            if (y[i]<0){
//                op[i]=3;
//            }else{
//                op[i]=1;
//            }
//        }
//        x[i]=abs(x[i]);
//        y[i]=abs(y[i]);
//        id[i]=i;
//    }
//
//    sort(id,id+n,cmpx);
//
//    ans=1000000000;
//    solve(0,n-1);
//
//  printf("%d\n",ans);
//    printf("%d %d %d %d\n",ansi+1,op[ansi],ansj+1,5-op[ansj]);
//
//    return 0;
//}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
int X[6]={0,1,-1,1,-1};
int Y[6]={0,1,1,-1,-1};
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                tmp.x=p[ne].x*X[i];
                tmp.y=p[ne].y*Y[i];
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1,m=n;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            for (j=1;j<=4;j++)
            {
                tmp.x=p[i].x*X[i];
                tmp.y=p[i].y*Y[i];
                p[cnt++]=tmp;
            }

        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
        nod ans=dfs(1,n);
        point a,b;
        bool ck=0;

        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 500005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
int X[6]={0,1,-1,1,-1};
int Y[6]={0,1,1,-1,-1};
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        bool flag=0;
        point tmp;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            tmp.x=a;tmp.y=b;tmp.id=i;tmp.k=1;
            pp[i]=p[i]=tmp;
        }

        int cnt=n+1,m=n;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            for (j=2;j<=4;j++)
            {
                tmp.x=p[i].x*X[j];
                tmp.y=p[i].y*Y[j];
                tmp.k=j;
                p[cnt++]=tmp;
            }

        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
        nod ans=dfs(1,n);
        point a,b;
        bool ck=0;

        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
//    printf("(%d) %d %d ",a.id,a.x,a.y);
//    printf("(%d) %d %d ",b.id,b.x,b.y);
//    cout<<(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)<<endl;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
//    cout<<l<<" "<<r<<endl;
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
     if( l+2 == r )
     {
        if (d.len>dis(p[l],p[l+1]))
        {
            d.a=p[l];
            d.b=p[l+1];
            d.len=dis(p[l],p[l+1]);
        }
        if (d.len>dis(p[l+1],p[r]))
        {
            d.a=p[l+1];
            d.b=p[r];
            d.len=dis(p[l+1],p[r]);
        }
        if (d.len>dis(p[l],p[r]))
        {
            d.a=p[l];
            d.b=p[r];
            d.len=dis(p[l],p[r]);
        }
        return d;
     }

    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            if (a<0)
            {
                if (b<0)
                    tmp.k=4;
                else
                    tmp.k=2;
            }
            else
            {
                if (b<0)
                    tmp.k=3;
                else
                    tmp.k=1;
            }
            tmp.x=tx;
            tmp.y=ty;
            tmp.id=i;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
//        int cnt=n+1;
//        for (i=1;i<=n;i++)
//        {
//            point tmp=p[i];
//            tmp=p[i];
//            tmp.k=1;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=2;
//            tmp.x=-p[i].x;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=3;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=4;
//            tmp.x=-p[i].x;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//        }
//        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        int x=ans.a.id,y=ans.b.id;
//        printf("%d\n",ans.len);
        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,5-ans.b.k);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid-1),d2=dfs(mid,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==0)
                {
                    tmp=p[ne];
                }
                else if (i==1)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==2)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==3)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,ans.b.k);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 500005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
int X[6]={0,1,-1,1,-1};
int Y[6]={0,1,1,-1,-1};
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;t.y=ty;t.id=i;t.k=1;
            tmp.x=a;tmp.y=b;tmp.id=i;tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                tmp.x=p[ne].x*X[i];
                tmp.y=p[ne].y*Y[i];
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1,m=n;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            for (j=2;j<=4;j++)
            {
                tmp.x=p[i].x*X[j];
                tmp.y=p[i].y*Y[j];
                tmp.k=j;
                p[cnt++]=tmp;
            }

        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
        nod ans=dfs(1,n);
        point a,b;
        bool ck=0;

        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
        int X[4]={1,-1,1,-1};
        int Y[4]={1,1,-1,-1};
        point a,b;
        bool ck=0;
        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 500005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
} p[M],pp[M];
int n,m;
int X[6]= {0,1,-1,1,-1};
int Y[6]= {0,1,1,-1,-1};
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0; i<p1.size(); i++)
    {
        for (j=0; j<p2.size(); j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    if( l+2 == r )
    {
        if (d.len>dis(p[l],p[l+1]))
        {
            d.a=p[l];
            d.b=p[l+1];
            d.len=dis(p[l],p[l+1]);
        }
        if (d.len>dis(p[l+1],p[r]))
        {
            d.a=p[l+1];
            d.b=p[r];
            d.len=dis(p[l+1],p[r]);
        }
        if (d.len>dis(p[l],p[r]))
        {
            d.a=p[l];
            d.b=p[r];
            d.len=dis(p[l],p[r]);
        }
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid; i>=l; i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1; i<=r; i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        bool flag=0;
        point tmp;
        for (i=1; i<=n; i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
        }

        int cnt=n+1,m=n;
        for (i=1; i<=n; i++)
        {
            point tmp=p[i];
            for (j=2; j<=4; j++)
            {
                tmp.x=p[i].x*X[j];
                tmp.y=p[i].y*Y[j];
                tmp.k=j;
                p[cnt++]=tmp;
            }

        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
        nod ans=dfs(1,n);
        point a,b;
        bool ck=0;

        for (i=1; i<=4; i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1; j<=4; j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,ans.b.k);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid-1),d2=dfs(mid,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==0)
                {
                    tmp=p[ne];
                }
                else if (i==1)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==2)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==3)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
        printf("%d\n",ans.len);
        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,ans.b.k);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
int X[6]={0,1,-1,1,-1};
int Y[6]={0,1,1,-1,-1};
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                tmp.x=p[ne].x*X[i];
                tmp.y=p[ne].y*Y[i];
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1,m=n;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            for (j=1;j<=4;j++)
            {
                tmp.x=p[i].x*X[j];
                tmp.y=p[i].y*Y[j];
                p[cnt++]=tmp;
            }

        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
        nod ans=dfs(1,n);
        point a,b;
        bool ck=0;

        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
        int X[4]={1,-1,1,-1};
        int Y[4]={1,1,-1,-1};
        point a,b;
        bool ck=0;
        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",pp[i].x,pp[i].y);
        int cnt=n+1,m=n;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);

//        for (i=1;i<=m;i++)
//            printf("%d %d\n",pp[i].x,pp[i].y);

//        printf("%d\n",ans.len);

        int X[6]={0,1,-1,1,-1};
        int Y[6]={0,1,1,-1,-1};
        point a,b;
        bool ck=0;

        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
//                    cout<<"id[a]="<<ans.a.id<<" id[b]="<<ans.b.id<<endl;
//                    cout<<pp[ans.a.id].x<<" "<<pp[ans.a.id].y<<" "<<pp[ans.b.id].x<<" "<<pp[ans.b.id].y<<endl;
//                    cout<<a.x<<" "<<a.y<<" "<<b.x<<" "<<b.y<<endl;
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid-1),d2=dfs(mid,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            if (a<0)
            {
                if (b<0)
                    tmp.k=4;
                else
                    tmp.k=2;
            }
            else
            {
                if (b<0)
                    tmp.k=3;
                else
                    tmp.k=1;
            }
            tmp.x=tx;
            tmp.y=ty;
            tmp.id=i;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
//        int cnt=n+1;
//        for (i=1;i<=n;i++)
//        {
//            point tmp=p[i];
//            tmp=p[i];
//            tmp.k=1;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=2;
//            tmp.x=-p[i].x;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=3;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=4;
//            tmp.x=-p[i].x;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//        }
//        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        int x=ans.a.id,y=ans.b.id;

        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,5-ans.b.k);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid),d2=dfs(mid+1,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            tmp.x=a;
            tmp.y=b;
            tmp.id=i;
            tmp.k=1;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
        int cnt=n+1;
        for (i=1;i<=n;i++)
        {
            point tmp=p[i];
            tmp=p[i];
            tmp.k=4;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=2;
            tmp.x=-p[i].x;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=3;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;

            tmp=p[i];
            tmp.k=1;
            tmp.x=-p[i].x;
            tmp.y=-p[i].y;
            p[cnt++]=tmp;
        }
        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
        int X[4]={1,-1,1,-1};
        int Y[4]={1,1,-1,-1};
        point a,b;
        bool ck=0;
        for (i=1;i<=4;i++)
        {
            a.x=pp[ans.a.id].x*X[i];
            a.y=pp[ans.a.id].y*Y[i];
            for (j=1;j<=4;j++)
            {
                b.x=pp[ans.b.id].x*X[j];
                b.y=pp[ans.b.id].y*Y[j];
                if ((a.x+b.x)*(a.x+b.x)+(a.y+b.y)*(a.y+b.y)==ans.len)
                {
                    ck=1;
                    break;
                }
            }
            if (ck) break;
        }
        printf("%d %d %d %d\n",ans.a.id,i,ans.b.id,j);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 400005
struct point
{
    int x,y,id,k;
    bool operator <(const point &b) const
    {
        if (x!=b.x) return x<b.x;
        else if (y!=b.y) return y<b.y;
        else if (id!=b.id) return id<b.id;
        return k<b.k;
    }
}p[M],pp[M];
int n,m;
struct nod
{
    point a,b;
    int len;
};
map<point,int> have;
bool cmpx(point a,point b)
{
    return a.x<b.x;
}
bool cmpy(point a,point b)
{
    return a.y>b.y;
}
int dis(point a,point b)
{
    if (a.id==b.id) return 1<<30;
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
nod Find(vector<point> p1,vector<point> p2,nod d)
{
    int i,j;
    nod dx;
    dx.len=1<<30;
    sort(p1.begin(),p1.end(),cmpy);
    sort(p2.begin(),p2.end(),cmpy);
    for (i=0;i<p1.size();i++)
    {
        for (j=0;j<p2.size();j++)
        {
            int t=dis(p1[i],p2[j]);
            if (dx.len>t)
            {
                dx.a=p1[i];
                dx.b=p2[j];
                dx.len=t;
            }
            if (p1[i].y-p2[j].y>d.len) break;
        }
    }
    return dx;
}
nod dfs(int l,int r)
{
    nod d;
    d.a=p[l];
    d.b=p[r];
    d.len=1<<30;
    if (r-l<1) return d;
    if (r-l==1)
    {
        d.len=dis(p[l],p[r]);
        d.a=p[l];
        d.b=p[r];
        return d;
    }
     if( l+2 == r )
     {
        if (d.len>dis(p[l],p[l+1]))
        {
            d.a=p[l];
            d.b=p[l+1];
            d.len=dis(p[l],p[l+1]);
        }
        if (d.len>dis(p[l+1],p[r]))
        {
            d.a=p[l+1];
            d.b=p[r];
            d.len=dis(p[l+1],p[r]);
        }
        if (d.len>dis(p[l],p[r]))
        {
            d.a=p[l];
            d.b=p[r];
            d.len=dis(p[l],p[r]);
        }
        return d;
     }

    int i,j;
    int mid=(l+r)>>1;
    int m=p[mid].x;
    nod d1=dfs(l,mid-1),d2=dfs(mid,r);
    if (d1.len<d2.len)
        d=d1;
    else
        d=d2;
    vector<point> p1,p2;
    for (i=mid-1;i>=l;i--)
    {
        if (m-p[i].x>d.len) break;
        p1.push_back(p[i]);
    }
    for (i=mid+1;i<=r;i++)
    {
        if (p[i].x-m>d.len) break;
        p2.push_back(p[i]);
    }
    nod dx=Find(p1,p2,d);
    if (dx.len<d.len)
        return dx;
    return d;
}
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while (scanf("%d",&n)!=EOF)
    {
        int i,j;
        int old,ne;
        have.clear();
        bool flag=0;
        for (i=1;i<=n;i++)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            if (flag) continue;
            int tx=abs(a),ty=abs(b);
            point t,tmp;
            t.x=tx;
            t.y=ty;
            t.id=i;
            t.k=1;
            if (a<0)
            {
                if (b<0)
                    tmp.k=4;
                else
                    tmp.k=2;
            }
            else
            {
                if (b<0)
                    tmp.k=3;
                else
                    tmp.k=1;
            }
            tmp.x=tx;
            tmp.y=ty;
            tmp.id=i;
            pp[i]=p[i]=tmp;
            if (have.find(t)!=have.end())
            {
                flag=1;
                old=have[t];
                ne=i;
            }
        }
        if (flag)
        {
            point tmp=p[ne];
            for (i=1;i<=4;i++)
            {
                if (i==1)
                {
                    tmp=p[ne];
                }
                else if (i==2)
                {
                    tmp.x=-p[ne].x;
                }
                else if (i==3)
                {
                    tmp.y=-p[ne].y;
                }
                else if (i==4)
                {
                    tmp.x=-p[ne].x;
                    tmp.y=-p[ne].y;
                }
                if (tmp.x+p[old].x==0 && tmp.y+p[old].y==0)
                {
                    printf("%d %d %d %d\n",old,1,ne,i);
                    break;
                }
            }
            continue;
        }
//        int cnt=n+1;
//        for (i=1;i<=n;i++)
//        {
//            point tmp=p[i];
//            tmp=p[i];
//            tmp.k=1;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=2;
//            tmp.x=-p[i].x;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=3;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//
//            tmp=p[i];
//            tmp.k=4;
//            tmp.x=-p[i].x;
//            tmp.y=-p[i].y;
//            p[cnt++]=tmp;
//        }
//        n=cnt-1;
        sort(p+1,p+n+1,cmpx);
//        for (i=1;i<=n;i++)
//            printf("%d %d\n",p[i].x,p[i].y);
        nod ans=dfs(1,n);
//        printf("%d\n",ans.len);
//        for (i=1;i<=4;i++)
        int x=ans.a.id,y=ans.b.id;

        printf("%d %d %d %d\n",ans.a.id,ans.a.k,ans.b.id,5-ans.b.k);
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
const double inf = 1e100;
struct Point
{
    double x,y;
    int id;
    Point() {}
    Point(double _x ,double _y,int _id)
    {
        x = _x ;
        y = _y;
        id = _id;
    }
};

Point pnt[100010];

double calc_dis(Point &a ,Point &b)
{
    return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}
//±ðÍüÁËÅÅÐò
bool operator<(const Point &a ,const Point &b)
{
    if(a.y == b.y) return a.x < b.x;
    return a.y < b.y;
}
double Gao(int l ,int r ,Point pnts[] ,int &lid ,int &rid)
{
    double ret = inf;
    if(l == r) return ret;
    if(l+1 ==r)
    {
        if(calc_dis(pnts[l],pnts[l+1]) <ret)
        {
            ret = calc_dis(pnts[l],pnts[l+1]);
            lid = l;
            rid = l+1;
        }
        return ret;
    }
    if(l+2 ==r)
    {
        if(calc_dis(pnts[l],pnts[l+1]) <ret)
        {
            ret = calc_dis(pnts[l],pnts[l+1]);
            lid = l;
            rid =l+1;
        }
        if(calc_dis(pnts[l],pnts[l+2]) < ret)
        {
            ret = calc_dis(pnts[l],pnts[l+2]);
            lid = l ;
            rid = l+2;
        }
        if(calc_dis(pnts[l+1],pnts[l+2]) < ret)
        {
            ret = calc_dis(pnts[l+1],pnts[l+2]);
            lid = l+1;
            rid = l+2;
        }
        return ret;
    }

    int mid = l+r>>1;
    int lid1,rid1,lid2,rid2;
    double lret = Gao(l ,mid,pnts,lid1,rid1);
    double rret = Gao(mid+1, r,pnts,lid2,rid2);
    if(lret < ret)
    {
        ret = lret;
        lid = lid1;
        rid = rid1;
    }
    if(rret <ret)
    {
        ret = rret;
        lid = lid2;
        rid = rid2;
    }

    for(int c = l ; c<=r; c++)
        for(int d = c+1; d <=c+7 && d<=r; d++)
        {
            //ret = min(ret , );
            if(calc_dis(pnts[c],pnts[d]) <ret)
            {
                ret = calc_dis(pnts[c],pnts[d]);
                lid = c;
                rid = d;
            }
        }
    return ret;
}
int trans[100000];
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    int n;
    while(scanf("%d",&n) == 1)
    {
        if(n == 0)break;
        double ans = inf;
        for(int i = 0 ; i< n ; i++)
        {
            scanf("%lf%lf",&pnt[i].x, &pnt[i].y);
            trans[i] = 1;
            if (pnt[i].x < 0 && pnt[i].y >= 0)
            {
                pnt[i].x = abs(pnt[i].x);
                trans[i] = 2;
            }
            else if (pnt[i].x >= 0 && pnt[i].y < 0)
            {
                pnt[i].y = abs(pnt[i].y);
                trans[i] = 3;
            }
            else if (pnt[i].x < 0 && pnt[i].y < 0)
            {
                pnt[i].x = abs(pnt[i].x);
                pnt[i].y = abs(pnt[i].y);
                trans[i] = 4;
            }
            pnt[i].id = i;
        }
        sort(pnt,pnt+n);
        int lid,rid;
        ans = Gao(0 , n-1 ,pnt,lid,rid);
        //printf("%.3f\n",ans);
        lid = pnt[lid].id;
        rid = pnt[rid].id;
        printf("%d %d %d %d\n",lid+1,trans[lid],rid+1,5-trans[rid]);
    }
    return 0;
}


#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <map>
#include <vector>
using namespace std;

const double inf = 1e100;

struct Point
{
    double x,y;
    int id;
    Point() {}
    Point(double _x ,double _y,int _id)
    {
        x = _x ;
        y = _y;
        id = _id;
    }
};

Point p[100010];
const int step[9][2] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,0},{0,1},{1,-1},{1,0},{1,1}};
int n,x,y,nx,ny;
map<pair<int,int>,vector<Point > > g;
vector<Point > tmp;
double tx,ty,ans,nowans;
vector<Point >::iterator it,op,ed;
pair<int,int> gird;
bool flag;

double CalcDis(Point p0,Point p1)
{
    return sqrt((p0.x-p1.x)*(p0.x-p1.x)+(p0.y-p1.y)*(p0.y-p1.y));
}

double preans;

void build(int n,double w)
{
    if (preans*0.8 < w) return;
    g.clear();
    for (int i = 0; i < n; i++)
        g[make_pair((int)floor(p[i].x/w),(int)floor(p[i].y/w))].push_back(p[i]);
    preans = w;
}

double Gao(int &lid ,int &rid)
{
    random_shuffle(p,p+n);
    ans = CalcDis(p[0],p[1]);
    lid = p[0].id;
    rid = p[1].id;
    build(2,ans);
    for (int i = 2; i < n; i++)
    {
        x = (int)floor(p[i].x/ans);
        y = (int)floor(p[i].y/ans);
        tmp.clear();
        for (int k = 0; k < 9; k++)
        {
            nx = x+step[k][0];
            ny = y+step[k][1];
            gird = make_pair(nx,ny);
            if (g.find(gird) != g.end())
            {
                op = g[gird].begin();
                ed = g[gird].end();
                for (it = op; it != ed; it++)
                    tmp.push_back(*it);
            }
        }
        flag = false;
        for (int j = 0; j < tmp.size(); j++)
        {
            nowans = CalcDis(p[i],tmp[j]);
            if (nowans < ans)
            {
                ans = nowans;
                lid = p[i].id;
                rid = tmp[j].id;
                flag = true;
            }
        }
        if (flag == true)
            build(i+1,ans);
        else
            g[make_pair((int)floor(p[i].x/ans),(int)floor(p[i].y/ans))].push_back(p[i]);
    }
    return ans;
}

int trans[100000];

int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while(scanf("%d",&n) != EOF)
    {
        for(int i = 0 ; i< n ; i++)
        {
            scanf("%lf%lf",&p[i].x, &p[i].y);
            trans[i] = 1;
            if (p[i].x < 0 && p[i].y >= 0)
            {
                p[i].x = abs(p[i].x);
                trans[i] = 2;
            }
            else if (p[i].x >= 0 && p[i].y < 0)
            {
                p[i].y = abs(p[i].y);
                trans[i] = 3;
            }
            else if (p[i].x < 0 && p[i].y < 0)
            {
                p[i].x = abs(p[i].x);
                p[i].y = abs(p[i].y);
                trans[i] = 4;
            }
            p[i].id = i;
        }
        int lid,rid;
        ans = Gao(lid,rid);
        printf("%d %d %d %d\n",lid+1,trans[lid],rid+1,5-trans[rid]);
    }
    return 0;
}


#include <cmath>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <stdio.h>
using namespace std;
const double inf = 1e100;
struct Node
{
    double x,y;
    int id;
}pt[100005];
int Y_sort[100005];
double MinN(double a,double b)
{
    if(a<b) return a;
    else return b;
}
inline double Distance(Node &a,Node &b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
 int CMP_X(const void *a,const void *b)
{
    if(((Node*)a)->x<((Node*)b)->x) return -1;
    else return 1;
}
int CMP_Y(const void *a,const void *b)
{
    if(pt[(*(int*)a)].y<pt[(*(int*)b)].y) return -1;
    else return 1;
}
double Nearest_Point_Distance(int first,int end,int &lid,int &rid)//first end 指点在pt数组中的下标，并假设pt已经按x排序
{
    if(end-first==1) {
    lid = first;
    rid = first+1;
    return Distance(pt[first],pt[first+1]);
    }
    else if(end-first==2) {
        double ret = inf;
        double l1 = Distance(pt[first],pt[first+1]);
        double l2 = Distance(pt[first+1],pt[first+2]);
        double l3 = Distance(pt[first],pt[first+2]);
        if(ret > l1){
            ret = l1;
            lid = first;
            rid = first+1;
        }
        if(ret > l2){
            ret = l2;
            lid = first+1;
            rid = first+2;
        }
        if(ret > l3){
            ret = l3;
            lid = first;
            rid = first+2;
        }
        return ret;
    }
    int mid=(first+end)/2;
    int lid1 ,rid1;
    int lid2,rid2;
    double l1 = Nearest_Point_Distance(first,mid,lid1,rid1);
    double l2 = Nearest_Point_Distance(mid+1,end,lid2,rid2);
    double min_dist=inf;
    if(l1 < min_dist){
        min_dist = l1;
        lid = lid1;
        rid = rid1;
    }
    if(l2 < min_dist){
        min_dist = l2;
        lid = lid2;
        rid = rid2;
    }
    int Y_end=0;
    for(int i=mid;i>=first&&(pt[mid].x-pt[i].x)<min_dist;i--)
    {
        Y_sort[Y_end++]=i;
    }
    for(int i=mid+1;i<=end&&(pt[i].x-pt[mid+1].x)<min_dist;i++)
    {
        Y_sort[Y_end++]=i;
    }
    qsort(Y_sort,Y_end,sizeof(Y_sort[0]),CMP_Y);
    /*for(int i=0;i<Y_end;i++)
    {
        for(int j=1;j<8&&i+j<Y_end;j++)
        {
            min_dist=MinN(min_dist,Distance(pt[Y_sort[i]],pt[Y_sort[i+j]]));
        }
    }*/
    for(int i=0;i<Y_end;i++)//上面那种也可以，但貌似速度慢点
    {
        for(int j=i+1;j<Y_end&&pt[Y_sort[j]].y-pt[Y_sort[i]].y<min_dist;j++)
        {
            double ll = Distance(pt[Y_sort[i]],pt[Y_sort[j]]);
            if(ll < min_dist){
                min_dist = ll;
                lid = Y_sort[i];
                rid = Y_sort[j];
            }
        }
    }
    return min_dist;
}
int trans[100010];
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    int n;
    while(scanf("%d",&n) == 1)
    {
        if(n == 0)break;
        double ans = inf;
        for(int i = 0 ; i< n ; i++)
        {
            scanf("%lf%lf",&pt[i].x, &pt[i].y);
            trans[i] = 1;
            if (pt[i].x < 0 && pt[i].y >= 0)
            {
                pt[i].x = abs(pt[i].x);
                trans[i] = 2;
            }
            else if (pt[i].x >= 0 && pt[i].y < 0)
            {
                pt[i].y = abs(pt[i].y);
                trans[i] = 3;
            }
            else if (pt[i].x < 0 && pt[i].y < 0)
            {
                pt[i].x = abs(pt[i].x);
                pt[i].y = abs(pt[i].y);
                trans[i] = 4;
            }
            pt[i].id = i;
        }
        qsort(pt,n,sizeof(pt[0]),CMP_X);
        int lid,rid;
        ans = Nearest_Point_Distance(0 , n-1,lid,rid);
        //printf("%.3f\n",ans);
        lid = pt[lid].id;
        rid = pt[rid].id;
        printf("%d %d %d %d\n",lid+1,trans[lid],rid+1,5-trans[rid]);
    }
    return 0;
}


#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <map>
#include <vector>
using namespace std;

const double inf = 1e100;

struct Point
{
    double x,y;
    int id;
    Point() {}
    Point(double _x ,double _y,int _id)
    {
        x = _x ;
        y = _y;
        id = _id;
    }
};

Point p[100010];
const int step[9][2] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,0},{0,1},{1,-1},{1,0},{1,1}};
int n,x,y,nx,ny;
map<pair<int,int>,vector<Point > > g;
vector<Point > tmp;
double tx,ty,ans,nowans;
vector<Point >::iterator it,op,ed;
pair<int,int> gird;
bool flag;

double CalcDis(Point p0,Point p1)
{
    return sqrt((p0.x-p1.x)*(p0.x-p1.x)+(p0.y-p1.y)*(p0.y-p1.y));
}

void build(int n,double w)
{
    g.clear();
    for (int i = 0; i < n; i++)
        g[make_pair((int)floor(p[i].x/w),(int)floor(p[i].y/w))].push_back(p[i]);
}

double Gao(int &lid ,int &rid)
{
    random_shuffle(p,p+n);
    ans = CalcDis(p[0],p[1]);
    lid = p[0].id;
    rid = p[1].id;
    build(2,ans);
    for (int i = 2; i < n; i++)
    {
        x = (int)floor(p[i].x/ans);
        y = (int)floor(p[i].y/ans);
        tmp.clear();
        for (int k = 0; k < 9; k++)
        {
            nx = x+step[k][0];
            ny = y+step[k][1];
            gird = make_pair(nx,ny);
            if (g.find(gird) != g.end())
            {
                op = g[gird].begin();
                ed = g[gird].end();
                for (it = op; it != ed; it++)
                    tmp.push_back(*it);
            }
        }
        flag = false;
        for (int j = 0; j < tmp.size(); j++)
        {
            nowans = CalcDis(p[i],tmp[j]);
            if (nowans < ans)
            {
                ans = nowans;
                lid = p[i].id;
                rid = tmp[j].id;
                flag = true;
            }
        }
        if (flag == true)
            build(i+1,ans);
        else
            g[make_pair((int)floor(p[i].x/ans),(int)floor(p[i].y/ans))].push_back(p[i]);
    }
    return ans;
}

int trans[100000];

int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    while(scanf("%d",&n) != EOF)
    {
        for(int i = 0 ; i< n ; i++)
        {
            scanf("%lf%lf",&p[i].x, &p[i].y);
            trans[i] = 1;
            if (p[i].x < 0 && p[i].y >= 0)
            {
                p[i].x = abs(p[i].x);
                trans[i] = 2;
            }
            else if (p[i].x >= 0 && p[i].y < 0)
            {
                p[i].y = abs(p[i].y);
                trans[i] = 3;
            }
            else if (p[i].x < 0 && p[i].y < 0)
            {
                p[i].x = abs(p[i].x);
                p[i].y = abs(p[i].y);
                trans[i] = 4;
            }
            p[i].id = i;
        }
        int lid,rid;
        ans = Gao(lid,rid);
        printf("%d %d %d %d\n",lid+1,trans[lid],rid+1,5-trans[rid]);
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
const double inf = 1e100;
struct Point
{
    double x,y;
    int id;
    Point() {}
    Point(double _x ,double _y,int _id)
    {
        x = _x ;
        y = _y;
        id = _id;
    }
};

Point pnt[100010];

double calc_dis(Point &a ,Point &b)
{
    return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}
//±ðÍüÁËÅÅÐò
bool operator<(const Point &a ,const Point &b)
{
    if(a.y != b.y) return a.x < b.x;
    return a.y < b.y;
}
double Gao(int l ,int r ,Point pnts[] ,int &lid ,int &rid)
{
    double ret = inf;
    if(l == r) return ret;
    if(l+1 ==r)
    {
        if(calc_dis(pnts[l],pnts[l+1]) <ret)
        {
            ret = calc_dis(pnts[l],pnts[l+1]);
            lid = l;
            rid = l+1;
        }
        return ret;
    }
    if(l+2 ==r)
    {
        if(calc_dis(pnts[l],pnts[l+1]) <ret)
        {
            ret = calc_dis(pnts[l],pnts[l+1]);
            lid = l;
            rid =l+1;
        }
        if(calc_dis(pnts[l],pnts[l+2]) < ret)
        {
            ret = calc_dis(pnts[l],pnts[l+2]);
            lid = l ;
            rid = l+2;
        }
        if(calc_dis(pnts[l+1],pnts[l+2]) < ret)
        {
            ret = calc_dis(pnts[l+1],pnts[l+2]);
            lid = l+1;
            rid = l+2;
        }
        return ret;
    }

    int mid = l+r>>1;
    int lid1,rid1,lid2,rid2;
    double lret = Gao(l ,mid,pnts,lid1,rid1);
    double rret = Gao(mid+1, r,pnts,lid2,rid2);
    if(lret < ret)
    {
        ret = lret;
        lid = lid1;
        rid = rid1;
    }
    if(rret <ret)
    {
        ret = rret;
        lid = lid2;
        rid = rid2;
    }

    for(int c = l ; c<=r; c++)
        for(int d = c+1; d <=c+7 && d<=r; d++)
        {
            //ret = min(ret , );
            if(calc_dis(pnts[c],pnts[d]) <ret)
            {
                ret = calc_dis(pnts[c],pnts[d]);
                lid = c;
                rid = d;
            }
        }
    return ret;
}
int trans[100000];
int main()
{
    int n;
    while(scanf("%d",&n) == 1)
    {
        if(n == 0)break;
        double ans = inf;
        for(int i = 0 ; i< n ; i++)
        {
            scanf("%lf%lf",&pnt[i].x, &pnt[i].y);
            trans[i] = 1;
            if (pnt[i].x < 0 && pnt[i].y >= 0)
            {
                pnt[i].x = abs(pnt[i].x);
                trans[i] = 2;
            }
            else if (pnt[i].x >= 0 && pnt[i].y < 0)
            {
                pnt[i].y = abs(pnt[i].y);
                trans[i] = 3;
            }
            else if (pnt[i].x < 0 && pnt[i].y < 0)
            {
                pnt[i].x = abs(pnt[i].x);
                pnt[i].y = abs(pnt[i].y);
                trans[i] = 4;
            }
            pnt[i].id = i;
        }
        sort(pnt,pnt+n);
        int lid,rid;
        ans = Gao(0 , n-1 ,pnt,lid,rid);
        lid = pnt[lid].id;
        rid = pnt[rid].id;
        printf("%d %d %d %d\n",lid+1,trans[lid],rid+1,5-trans[rid]);
    }
    return 0;
}