#include <bits/stdc++.h>
using namespace std;
struct team_t {
  team_t(const string& name_) : name(name_), points(0), diff(0), goals(0) {}
  bool operator<(const team_t& t) const {
    if (points != t.points) return points > t.points;
    if (diff != t.diff) return diff > t.diff;
    if (goals != t.goals) return goals > t.goals;
    return name < t.name;
  }
  string name;
  int points, diff, goals;
};
vector<team_t> teams;
map<string, int> teamsMap;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    char name[50];
    scanf("%s", name);
    teamsMap.insert(make_pair(string(name), i));
    teams.push_back(team_t(name));
  }
  for (int i = 0; i < n * (n - 1) / 2; ++i) {
    char ts1[50], ts2[50];
    scanf(" %[A-Za-z]-%[A-Za-z] ", ts1, ts2);
    int g1, g2;
    scanf("%d:%d", &g1, &g2);
    const int t1 = teamsMap[string(ts1)], t2 = teamsMap[string(ts2)];
    teams[t1].diff += g1 - g2, teams[t1].goals += g1;
    teams[t2].diff += g2 - g1, teams[t2].goals += g2;
    if (g1 > g2)
      teams[t1].points += 3;
    else if (g2 > g1)
      teams[t2].points += 3;
    else
      ++teams[t1].points, ++teams[t2].points;
  }
  sort(teams.begin(), teams.end());
  vector<string> res;
  for (int i = 0; i < n / 2; ++i) res.push_back(teams[i].name);
  sort(res.begin(), res.end());
  for (int i = 0; i < (int)res.size(); ++i) printf("%s\n", res[i].c_str());
  return 0;
}
