/*
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello world!\n");
return 0;
}
*/
/*
#include <stdio.h>
typedef struct
{
int score;
int dpp;
}stu;
int main()
{
stu a[201];
int s;
scanf("%d", &s);
for(int i=1; i<=s; i++)
{
scanf("%d",&a[i].score);
}
for(int i=1; i<=s; i++)
{
// a[i]의 등수 구하기
a[i].dpp = 1;
for(int j=1; j<=s; j++)
{
if(a[i].score<a[j].score)
{
a[i].dpp++;
}
}
printf("%d %d", a[i].score, a[i].dpp);
printf("\n");
}
return 0;
}
*/
/*
#include <stdio.h>
int main()
{
char s;
scanf("%c", &s);
printf("DRX");
return 0;
}
*/
#include <stdio.h>
typedef struct
{
int conutry;
int student;
int score;
}stu;
int main()
{
stu a[1001];
int s, max=0;
scanf("%d", &s);
for(int i=1; i<=s; i++)
{
scanf("%d %d %d", &a[i].conutry, &a[i].student, &a[i].score);
}
for(int i=1; i<=s; i++)
{
if(a[i].score>max)
{
max=a[i].score;
printf("%d %d", a[i].conutry, a[i].student);
printf("\n");
}
}
return 0;
}