#include <bits/stdc++.h>
using namespace std;
struct st {
  int p, s, m;
  string name;
};
bool order(st a, st b) {
  if (a.p != b.p) return a.p < b.p;
  if (a.s - a.m != b.s - b.m) return a.s - a.m < b.s - b.m;
  return a.s < b.s;
}
bool lex(st a, st b) { return a.name < b.name; }
int main(int agrc, char *argv[]) {
  int N;
  cin >> N;
  map<string, st> team;
  st ini;
  ini.p = 0;
  ini.s = 0;
  ini.m = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    ini.name = s;
    team[s] = ini;
  }
  for (int i = 0; i < (N * (N - 1)) / 2; i++) {
    string match, res;
    cin >> match >> res;
    match.replace(match.find_first_of('-'), 1, " ");
    res.replace(res.find_first_of(':'), 1, " ");
    stringstream sm(match);
    string t1, t2;
    sm >> t1 >> t2;
    stringstream sr(res);
    int r1, r2;
    sr >> r1 >> r2;
    if (r1 > r2) team[t1].p += 3;
    if (r1 < r2) team[t2].p += 3;
    if (r1 == r2) {
      team[t1].p += 1;
      team[t2].p += 1;
    }
    team[t1].s += r1;
    team[t1].m += r2;
    team[t2].s += r2;
    team[t2].m += r1;
  }
  st steam[50];
  int id = 0;
  for (map<string, st>::iterator it = team.begin(); it != team.end(); it++) {
    steam[id++] = it->second;
  }
  sort(steam, steam + id, order);
  sort(steam + id / 2, steam + id, lex);
  for (int i = id / 2; i < N; i++) {
    cout << steam[i].name << endl;
  }
  return 0;
}
