public static void main(String args[]) {
        Scanner in = new Scanner(System.in);

        // game loop
        while (true) {
            List<Enemy> enemies = new ArrayList<Enemy>();

            int count = in.nextInt(); // The number of current enemy ships within range
            in.nextLine();
            for (int i = 0; i < count; i++) {
                enemies.add(new Enemy(in.next(), in.nextInt()));
                in.nextLine();
            }

            Collections.sort(enemies, new Comparator<Enemy>() {
                @Override
                public int compare(Enemy o1, Enemy o2) {
                    return o1.distance.compareTo(o2.distance);
                }
            });

            // Write an action using System.out.println()
            // To debug: System.err.println("Debug messages...");

            if(enemies.size() > 0) {
                System.out.println(enemies.get(0).name);
            }
        }
    }