#include <bits/stdc++.h>
using namespace std;
struct team {
  string name;
  int points;
  int diff;
  int hit;
  void print() {
    printf("TEAM: %s\n\tPoints: %d\n\tDifference: %d\n\tGoals: %d\n",
           name.c_str(), points, diff, hit);
  }
};
bool les(team a, team b) {
  if (a.points != b.points) return a.points > b.points;
  if (a.diff != b.diff) return a.diff > b.diff;
  return a.hit > b.hit;
}
bool les2(team a, team b) { return a.name < b.name; }
int n;
map<string, int> names;
team teams[100];
int n1, n2, a, b, m;
char buf[100], buf2[100];
string s, s1, s2;
int main() {
  scanf("%d\n", &n);
  for (int i = 0; i < n; ++i) {
    gets(buf);
    teams[i].name.assign(buf);
    names[teams[i].name] = i;
    teams[i].points = teams[i].diff = teams[i].hit = 0;
  }
  m = n * (n - 1) / 2;
  for (int i = 0; i < m; ++i) {
    scanf("%s %d:%d\n", &buf, &a, &b);
    s.assign(buf);
    int pos = s.find('-');
    s1 = s.substr(0, pos);
    s2 = s.substr(pos + 1);
    n1 = names[s1];
    n2 = names[s2];
    teams[n1].diff += (a - b);
    teams[n2].diff += (b - a);
    teams[n1].hit += a;
    teams[n2].hit += b;
    if (a > b)
      teams[n1].points += 3;
    else if (b > a)
      teams[n2].points += 3;
    else {
      teams[n1].points++;
      teams[n2].points++;
    }
  }
  sort(teams, teams + n, les);
  sort(teams, teams + n / 2, les2);
  for (int i = 0; i < n / 2; ++i) puts(teams[i].name.c_str());
  return 0;
}
