#include <cstdio> #include <iostream> #include <map> #include <string> using namespace std; int main() { int n; cin >> n; map<int, string> m; string name; int price; while (cin >> name >> price) { m.insert(make_pair(price, name)); } for (auto i : m) { cout << i.second << "\n"; } } // 64 位输出请用 printf("%lld")