#include<bits/stdc++.h>
using namespace std ;
const int maxn=100000 +100 ;
int a[maxn],b[maxn],c[maxn];
int main ()
{
int n,m=0 ;
scanf ("%d" ,&n);
for (int i=1 ;i<=n;i++)
{
scanf ("%d" ,&a[i]);
b[++m]=a[i];
}
sort(b+1 ,b+1 +m);
m=unique(b+1 ,b+1 +m)-b-1 ;
for (int i=1 ;i<=n;i++)
{
c[i]=lower_bound(b+1 ,b+1 +m,a[i])-b;
cout <<c[i]<<" " ;
}
cout <<endl;
}
//坐标离散化 或者数组离散化
using namespace std;
const int maxn=100000 +100 ;
struct node
{
int x ,id;
}point[maxn*2 +100 ];
int cmp(node aa,node bb)
{
return aa.x <bb.x ;
}
int cmmp(node aa,node bb)
{
if (aa.id==bb.id)
return aa.x <bb.x ;
return aa.id<bb.id;
}
int main ()
{
int n;
cin>>n;
int id=1 ;
for (int i=1 ;i<=2 *n ;i+=2 )
{
scanf("%d %d " ,&point[i].x ,&point[i+1 ].x );
point[i].id=id;
point[i+1 ].id=id++;
}
sort (point+1 ,point+1 +2 *n ,cmp);
int pre=-1 ,tot=0 ;
for (int i=1 ;i<=2 *n ;i++)
{
if (pre==point[i].x )
{
point[i].x =tot;
}
else
{
pre=point[i].x ;
point[i].x =++tot;
}
}
sort (point+1 ,point+1 +2 *n ,cmmp);
for (int i=1 ;i<=2 *n ;i+=2 )
{
printf ("%d %d \n" ,point[i].x ,point[i+1 ].x );
}
}