package com.codegym.task.task10.task1019;

import java.io.*;
import java.util.HashMap;
/*
Functionality is not enough!

*/

public class Solution {
    public static void main(String[] args) throws IOException {
        HashMap<String, Integer> map = new HashMap<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int id= 0;
        String idString;
        String name;
        while (true) {


            //NumberFormatException
            try{
                idString = reader.readLine();
                id = Integer.parseInt(idString);
                if (idString.equals(""))
                break;
            } catch ( NumberFormatException e)
            {
                e.printStackTrace();
            }

            name = reader.readLine();
            map.put(name, id);
            if (name.equals(""))
                break;

        }
        for (String x : map.keySet()) {
            System.out.println(map.get(x) + " " + x);
        }
    }
}