/*
#include <stdio.h>
long long int n;
long long int f(long long int n)
{
long long int a=0;
while(n!=0)
{
a=a*10+n%10;
n=n/10;
}
return a;
}
int main()
{
scanf("%lld", &n);
printf("%lld\n", f(n));
}
학생 100명의 나이와 성적 관리
자료형 data type
define
*/
/*
#include <stdio.h>
typedef struct
{
//멤버
int age;
char grade;
}student;
int main()
{
student arr[101];
arr[0].age=10;
arr[0].grade='A';
scanf("%d",&arr[0].age);
}
*/
/*
#include <stdio.h>
typedef struct
{
int score;
int grade;
}student;
int main()
{
int n;
student arr[201];
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&arr[i].score);
}
for(int i=1;i<=n;i++)
{
arr[i].grade=1;
for(int j=1;j<=n;j++)
{
if(arr[i].score < arr[j].score)
{
arr[i].grade++;
}
}
}
for(int i=1;i<=n;i++)
{
printf("%d %d\n", arr[i].score, arr[i].grade);
}
}
*/
#include <stdio.h>
typedef struct
{
int country;
int sn;
int score;
int grade;
}student;
int main()
{
int n;
student arr[101];
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d %d %d",&arr[i].country ,&arr[i].sn,&arr[i].score );
}
for(int i=1;i<=n;i++)
{
arr[i].grade=1;
for(int j=1;j<=n;j++)
{
if(arr[i].score < arr[j].score)
{
arr[i].grade++;
}
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
printf("%d %d\n", arr[i].country, arr[i].sn);
}
}
}