import java.util.TreeMap;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Standings {
    public static void main(String[] args) {
        TreeMap<String, Record> teams = new TreeMap<String, Record>();

        Scanner input = new Scanner(System.in);

        String team1 = input.next();
        int score1 = input.nextInt();
        String team2 = input.next();
        int score2 = input.nextInt();

        while (score1 >= 0 || score2 >= 0) {
            if (!teams.containsKey(team1)) {
                teams.put(team1, new Record(team1));
            }

            if (!teams.containsKey(team2)) {
                teams.put(team2, new Record(team2));
            }

            if (score1 > score2) {
                teams.get(team1).addWin();
                teams.get(team2).addLoss();
            }
            else {
                teams.get(team1).addLoss();
                teams.get(team2).addWin();
            }

            team1 = input.next();
            score1 = input.nextInt();
            team2 = input.next();
            score2 = input.nextInt();
        }

        ArrayList<Record> standings = new ArrayList<Record>();

        for (String teamName : teams.keySet()) {
            standings.add(teams.get(teamName));
        }
        Collections.sort(standings);

        for (Record t : standings) {
            System.out.println(t);
        }
        System.out.println("DONE");
    }
}


class Record implements Comparable<Record> {
    private String teamName;
    private int numWins;
    private int numLosses;
    
    public Record(String name) {
        this.teamName = name;
        this.numWins = 0;
        this.numLosses = 0;
    }
    
    public void addWin() {
        this.numWins++;
    }
    
    public void addLoss() {
        this.numLosses++;
    }
    
    public int compareTo(Record other) {
        if (other.numWins == this.numWins) {
            return this.teamName.compareTo(other.teamName);
        }
        else {
            return other.numWins - this.numWins;
        }
    }

    public String toString() {
        return this.teamName + " " + this.numWins + "-" + this.numLosses;
    }
}
