import java.util.HashMap;
import java.util.Map;

/*
Нам повторы не нужны
*/

public class Solution {
    public static HashMap<String, String> createMap() throws Exception {
        HashMap <String, String> map = new HashMap<String, String>();
        map.put("a", "b");
        map.put("b", "b");
        map.put("c", "b");
        map.put("d", "b");
        map.put("e", "b");
        map.put("f", "b");
        map.put("g", "b");
        map.put("h", "b");
        map.put("i", "b");
        map.put("j", "d");

        return map;
    }

    public static void removeTheFirstNameDuplicates(HashMap<String, String> map) throws Exception {
        for (Map.Entry<String, String> pair : map.entrySet()) {

            if (map.containsValue(pair.getValue())) {
                map.remove(pair.getKey());//напишите тут ваш код
            }
        }

        for (Map.Entry<String, String> pair : map.entrySet()) {
            System.out.println(pair);
        }

    }

    public static void main(String[] args) throws Exception {
        HashMap <String, String> map = createMap();

        removeTheFirstNameDuplicates (map);

    }
}