링크 : https://www.acmicpc.net/problem/10814
/*
문제 : 나이순 정렬
링크 : https://www.acmicpc.net/problem/10814
*/
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main(){
int N = 0;
cin >> N;
multimap<int, string> m;
for(int i = 0; i < N ; i++){
int n = 0;
string s = "";
cin >> n >> s;
m.insert(make_pair(n, s));
}
for(auto it = m.begin(); it != m.end(); it++){
cout << it -> first << " " << it -> second << '\n';
}
return 0;
}