package com.codegym.task.task10.task1019; import java.io.*; import java.util.*; 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>(); //int id = Integer.parseInt(reader.readLine()); //String name = reader.readLine(); while(true) { Integer id = Integer.parseInt(reader.readLine()); if(id== 0) break; String name = reader.readLine(); if(name.isEmpty() && id!= 0){ System.out.println(id); break; }else if(!name.isEmpty()&& id!=0){ map.put(name,id); } } for(Map.Entry<String,Integer> entry : map.entrySet()){ System.out.println(entry.getValue() +" "+ entry.getKey()); } } }