#include<stdio.h>
#include<math.h>
#include<string.h>
struct student
{
char name[16];
int score;
}all[50],t;
int main()
{
int i,j,people;
scanf("%d",&people);
for(i=0;i<people;i++)
scanf("%s%d",all[i].name,&all[i].score);
for(i=0;i<people-1;i++)
for(j=0;j<people-1-i;j++)
if(all[j].score<all[j+1].score)
{
t=all[j];
all[j]=all[j+1];
all[j+1]=t;
}
for(i=0;i<people;i++)
printf("%15s%5d\n",all[i].name,all[i].score);
return 0;
}
11-07
11-07