/* package whatever; // don't place package name! */

import java.util.*;
    import java.util.stream.*;
    import java.lang.*;
    import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
    public static void main (String[] args) throws java.lang.Exception
    {
        List<String> list = Stream.of(
                "06|20|1",
                "11|20|2",
                "11|20|2",
                "07|207|6",
                "11|207|2",
                "07|207|6"
        ).collect(Collectors.toList());
        HashMap<String, HashMap<String, String>> hashMap = new HashMap<>();
        HashMap<String, String> newhas = new HashMap<>();
        for (String line : list) {
            String key, value, priority;
            key = line.split("\\|", -1)[1];
            value = line.split("\\|", -1)[0];
            priority = line.split("\\|", -1)[2];

            if (hashMap.containsKey(key)) {
                HashMap<String, String> getPriority = hashMap.get(key);
                Map.Entry<String, String> entry = getPriority.entrySet().iterator().next();
                String oldKey = entry.getKey();
                String previousPrior = getPriority.get(oldKey);
                if (Integer.parseInt(priority) > Integer.parseInt(previousPrior)) {
                    getPriority.remove(oldKey);
                    getPriority.put(value,priority);
                    hashMap.put(key, getPriority);
                }
            } else {
                newhas = new HashMap<>();
                newhas.put(value, priority);
                hashMap.put(key, newhas);
            }

        }
        System.out.println(hashMap);
    }
}