#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
struct Mouse{
int weight;
string color;
}a[105];
bool comp(Mouse a,Mouse b){
return a.weight>b.weight;
}
int main(){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++){
cin>>a[i].weight>>a[i].color;
}
sort(a,a+n,comp);
for(int i=0;i<n;i++){
printf("%s\n",a[i].color.c_str());
}
return 0;
}

京公网安备 11010502036488号