package pl.codegym.task.task10.task1019;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
/*
Funkcjonalność to nie wszystko!
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
HashMap<String,Integer> map = new HashMap<String,Integer>();
try{
while(true){
int id = Integer.parseInt(reader.readLine());
String imie = reader.readLine();
if(imie.equals(" ") || imie.isEmpty() || imie.equals(null)){
break;
}
else{
map.put(imie, id);
}
}
}
catch (NumberFormatException n){
}
for (Map.Entry<String,Integer> para : map.entrySet()) {
System.out.println(para.getValue() + " " + para.getKey());
}
}
}