Не могу понять почему последнее условие не проходит
package com.javarush.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Модернизация ПО
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
HashMap<String, String> map = new HashMap<>();
while (true) {
String city = reader.readLine();
String family = reader.readLine();
if (family.isEmpty() && city.isEmpty()) break;
map.put(city, family);
}
String cityName = reader.readLine();
Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> pair = it.next();
if (pair.getKey().equals(cityName))
System.out.println(pair.getValue());
}
}
}