#include <bits/stdc++.h>
using namespace std;
struct team {
  string name;
  long int win = 0;
  long int deltagoals = 0;
  long int goals = 0;
};
struct pred {
  bool operator()(const team& h1, const team& h2) {
    if (h1.win != h2.win) {
      return h1.win > h2.win;
    } else if (h1.deltagoals != h2.deltagoals) {
      return h1.deltagoals > h2.deltagoals;
    } else
      return h1.goals > h2.goals;
  }
};
struct predname {
  bool operator()(const team& h1, const team& h2) { return h1.name < h2.name; }
};
int main() {
  int n, j = 0;
  long int scoreA = 0, scoreB = 0;
  cin >> n;
  vector<team> teams(n);
  char useless;
  string tmp, teamA, teamB;
  for (int i = 0; i < n; i++) {
    cin >> teams[i].name;
  }
  for (int i = 0; i < (n * (n - 1) / 2); i++) {
    cin >> tmp;
    while (tmp[j + 1] != '-') {
      j++;
    }
    teamA = tmp.substr(0, j + 1);
    tmp.erase(0, j + 2);
    teamB = tmp.substr(0, tmp.size());
    tmp.erase(0, tmp.size());
    j = 0;
    cin >> scoreA >> useless >> scoreB;
    for (int a = 0; a < n; a++) {
      if (teams[a].name == teamA) {
        if (scoreA > scoreB) {
          teams[a].win += 3;
        }
        if (scoreA == scoreB) {
          teams[a].win++;
        }
        teams[a].deltagoals += (scoreA - scoreB);
        teams[a].goals += scoreA;
      }
      if (teams[a].name == teamB) {
        if (scoreA < scoreB) {
          teams[a].win += 3;
        }
        if (scoreA == scoreB) {
          teams[a].win++;
        }
        teams[a].deltagoals += (scoreB - scoreA);
        teams[a].goals += scoreB;
      } else
        ;
    }
  }
  sort(teams.begin(), teams.end(), pred());
  sort(teams.begin(), teams.begin() + teams.size() / 2, predname());
  for (int i = 0; i < n / 2; i++) {
    cout << teams[i].name << endl;
  }
  return 0;
}
