#include <bits/stdc++.h>
using namespace std;
struct team {
  string team_id;
  int points;
  int scored_goals;
  int missed_goals;
  int S_M;
} teams[51];
int referer(int a, int b) {
  if (a > b)
    return 1;
  else if (a < b)
    return 2;
  else
    return 0;
}
string player_1(string str) {
  string player;
  int i = 0;
  while (str[i] != '-') {
    player.push_back(str[i]);
    i++;
  }
  return player;
}
string player_2(string str) {
  string player;
  int i = str.size() - 1;
  while (str[i] != '-') {
    player.push_back(str[i]);
    i--;
  }
  reverse(player.begin(), player.end());
  return player;
}
int player_id(vector<string> tms, string ply) {
  for (int i = 0; i < tms.size(); i++)
    if (ply == tms[i]) return i;
}
int main() {
  int team_no, score_1, score_2, i, j, player_1_id, player_2_id;
  char dot;
  string score, team_1, team_2;
  vector<string> teams_id;
  cin >> team_no;
  for (i = 0; i < team_no; i++) {
    cin >> teams[i].team_id;
    teams_id.push_back(teams[i].team_id);
  }
  int games = team_no * (team_no - 1) / 2;
  for (i = 0; i < games; i++) {
    cin >> score >> score_1 >> dot >> score_2;
    player_1_id = player_id(teams_id, player_1(score));
    player_2_id = player_id(teams_id, player_2(score));
    switch (referer(score_1, score_2)) {
      case 0: {
        teams[player_1_id].points += 1;
        teams[player_2_id].points += 1;
        teams[player_1_id].scored_goals += score_1;
        teams[player_1_id].missed_goals += score_2;
        teams[player_2_id].scored_goals += score_2;
        teams[player_2_id].missed_goals += score_1;
        break;
      }
      case 1: {
        teams[player_1_id].points += 3;
        teams[player_1_id].scored_goals += score_1;
        teams[player_1_id].missed_goals += score_2;
        teams[player_2_id].scored_goals += score_2;
        teams[player_2_id].missed_goals += score_1;
        break;
      }
      case 2: {
        teams[player_2_id].points += 3;
        teams[player_1_id].scored_goals += score_1;
        teams[player_1_id].missed_goals += score_2;
        teams[player_2_id].scored_goals += score_2;
        teams[player_2_id].missed_goals += score_1;
        break;
      }
    }
  }
  for (i = 0; i < team_no; i++)
    teams[i].S_M = teams[i].scored_goals - teams[i].missed_goals;
  for (i = 0; i < team_no - 1; i++) {
    for (j = 0; j < team_no - i - 1; j++) {
      if (teams[j].points < teams[j + 1].points)
        swap(teams[j], teams[j + 1]);
      else {
        if (teams[j].points == teams[j + 1].points) {
          if (teams[j].S_M < teams[j + 1].S_M)
            swap(teams[j], teams[j + 1]);
          else {
            if (teams[j].S_M == teams[j + 1].S_M) {
              if (teams[j].scored_goals < teams[j + 1].scored_goals)
                swap(teams[j], teams[j + 1]);
            }
          }
        }
      }
    }
  }
  teams_id.clear();
  for (i = 0; i < team_no / 2; i++) teams_id.push_back(teams[i].team_id);
  sort(teams_id.begin(), teams_id.end());
  for (i = 0; i < teams_id.size(); i++) cout << teams_id[i] << endl;
  return 0;
}
