#include <bits/stdc++.h>
using namespace std;
struct team {
  string name;
  int khorde;
  int zade;
  int point;
  void init() {
    name = "";
    khorde = point = zade = 0;
  }
};
bool operator<(team a, team b) {
  if (a.point != b.point)
    return (a.point > b.point);
  else if ((a.zade - a.khorde) != (b.zade - b.khorde))
    return ((a.zade - a.khorde) > (b.zade - b.khorde));
  else if (a.zade != b.zade)
    return (a.zade > b.zade);
  else
    return (a.name < b.name);
}
bool lex(team a, team b) { return (a.name < b.name); }
int main() {
  int n;
  cin >> n;
  team all[n];
  for (int i = 0; i < n; i++) {
    all[i].init();
    cin >> all[i].name;
  }
  for (int i = 0; (i < n * (n - 1) / 2); i++) {
    string input;
    cin >> input;
    string team1, team2;
    team1 = input.substr(0, input.find("-"));
    team2 = input.substr(input.find("-") + 1, input.length());
    int point1, point2;
    char temp;
    cin >> point1 >> temp >> point2;
    for (int i = 0; i < n; i++) {
      if (all[i].name == team1) {
        all[i].zade += point1;
        all[i].khorde += point2;
        if (point1 > point2)
          all[i].point += 3;
        else if (point1 == point2)
          all[i].point += 1;
      } else if (all[i].name == team2) {
        all[i].zade += point2;
        all[i].khorde += point1;
        if (point2 > point1)
          all[i].point += 3;
        else if (point2 == point1)
          all[i].point += 1;
      }
    }
  }
  sort(all, all + n);
  sort(all, all + n / 2, lex);
  for (int i = 0; i < n / 2; i++) cout << all[i].name << endl;
  return 0;
}
