#include <bits/stdc++.h>
using namespace std;
struct Node {
  char name[35];
  int score, miss, point;
};
Node team[55];
bool cmp(Node a, Node b) {
  if (a.point != b.point) return a.point > b.point;
  if (a.score - a.miss != b.score - b.miss)
    return a.score - a.miss > b.score - b.miss;
  return a.score > b.score;
}
bool cmp1(Node a, Node b) { return strcmp(a.name, b.name) < 0; }
int main() {
  int n;
  scanf("%d", &n);
  map<string, int> getid;
  for (int i = 0; i < n; i++) {
    scanf("%s", team[i].name);
    getid[team[i].name] = i;
  }
  getchar();
  for (int j = 0; j < n * (n - 1) / 2; j++) {
    string str;
    getline(cin, str);
    string n1, n2;
    int i = 0, s1 = 0, s2 = 0;
    while (str[i] != '-') n1 += str[i], i++;
    i++;
    while (str[i] != ' ') n2 += str[i], i++;
    i++;
    while (str[i] != ':') s1 = s1 * 10 + str[i] - '0', i++;
    i++;
    while (str[i]) s2 = s2 * 10 + str[i] - '0', i++;
    int t1 = getid[n1], t2 = getid[n2];
    team[t1].score += s1, team[t1].miss += s2;
    team[t2].score += s2, team[t2].miss += s1;
    if (s1 > s2)
      team[t1].point += 3;
    else if (s1 == s2) {
      team[t1].point++;
      team[t2].point++;
    } else
      team[t2].point += 3;
  }
  sort(team, team + n, cmp);
  sort(team, team + n / 2, cmp1);
  for (int i = 0; i < n / 2; i++) printf("%s\n", team[i].name);
  return 0;
}
