#include <iostream> #include <string> #include <cstdio> #include <algorithm> using namespace std; const int N = 100; int n; int main() { cin >> n; int a[n]; string b[n]; for (int i = 0 ; i < n; i++) { cin >> a[i] >> b[i]; } //对白鼠重量排序 int temp; string t; for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - 1 - i; j++) { if (a[j] < a[j + 1]) { temp = a[j]; a[j] = a[j + 1]; a[j + 1] = temp; t = b[j]; b[j] = b[j + 1]; b[j + 1] = t; } } } for (int i = 0; i < n; i++) cout << b[i] << endl; return 0; }