#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<std::pair<std::string, std::pair<int, std::pair<int, int>>>>
      teams;
  for (int i = 0; i < n; i++) {
    std::string team;
    std::cin >> team;
    teams.push_back(
        std::make_pair(team, std::make_pair(0, std::make_pair(0, 0))));
  }
  int input = n * (n - 1) / 2;
  for (int i = 0; i < input; i++) {
    std::string event, team1, team2;
    int goals1, goals2;
    char dots;
    std::cin >> event >> goals1 >> dots >> goals2;
    team1 = event.substr(0, event.find('-'));
    team2 = event.substr(event.find('-') + 1);
    if (goals1 > goals2) {
      for (int j = 0; j < n; j++) {
        if (teams[j].first == team1) {
          teams[j].second.first = teams[j].second.first + 3;
          teams[j].second.second.first = teams[j].second.second.first + goals1;
          teams[j].second.second.second =
              teams[j].second.second.second + goals2;
        }
        if (teams[j].first == team2) {
          teams[j].second.second.first = teams[j].second.second.first + goals2;
          teams[j].second.second.second =
              teams[j].second.second.second + goals1;
        }
      }
    } else if (goals1 < goals2) {
      for (int j = 0; j < n; j++) {
        if (teams[j].first == team2) {
          teams[j].second.first = teams[j].second.first + 3;
          teams[j].second.second.first = teams[j].second.second.first + goals2;
          teams[j].second.second.second =
              teams[j].second.second.second + goals1;
        }
        if (teams[j].first == team1) {
          teams[j].second.second.first = teams[j].second.second.first + goals1;
          teams[j].second.second.second =
              teams[j].second.second.second + goals2;
        }
      }
    } else {
      for (int j = 0; j < n; j++) {
        if (teams[j].first == team2 || teams[j].first == team1) {
          teams[j].second.first++;
          teams[j].second.second.first = teams[j].second.second.first + goals1;
          teams[j].second.second.second =
              teams[j].second.second.second + goals1;
        }
      }
    }
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < n - i - 1; j++) {
      if (teams[j].second.first > teams[j + 1].second.first) {
        swap(teams[j], teams[j + 1]);
      }
      if (teams[j].second.first == teams[j + 1].second.first) {
        if (teams[j].second.second.first - teams[j].second.second.second >
            teams[j + 1].second.second.first -
                teams[j + 1].second.second.second) {
          swap(teams[j], teams[j + 1]);
        }
        if (teams[j].second.second.first - teams[j].second.second.second ==
            teams[j + 1].second.second.first -
                teams[j + 1].second.second.second) {
          if (teams[j].second.second.first > teams[j + 1].second.second.first) {
            swap(teams[j], teams[j + 1]);
          }
        }
      }
    }
  }
  for (int i = n / 2; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (teams[i].first > teams[j].first) {
        swap(teams[i], teams[j]);
      }
    }
  }
  for (int i = n / 2; i < n; i++) {
    std::cout << teams[i].first << '\n';
  }
  return 0;
}
