#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  char str[1000];
  scanf("%d", &n);
  map<string, tuple<int, int, int>> team;
  for (int i = 0; i < n; i++) {
    scanf("%s", str);
    team[str] = {};
  }
  m = n * (n - 1) / 2;
  for (int i = 0; i < m; i++) {
    scanf("%*[\n -]%[a-zA-Z]", str);
    tuple<int, int, int>& x = team[str];
    scanf("%*[\n -]%[a-zA-Z]", str);
    tuple<int, int, int>& y = team[str];
    int xs, ys, xc = 0, yc = 0;
    scanf("%d:%d", &xs, &ys);
    if (xs > ys) xc = 3;
    if (xs < ys) yc = 3;
    if (xs == ys) xc = yc = 1;
    get<0>(x) += xc;
    get<0>(y) += yc;
    get<1>(x) += xs - ys;
    get<1>(y) += ys - xs;
    get<2>(x) += xs;
    get<2>(x) += ys;
  }
  vector<pair<tuple<int, int, int>, string>> u;
  for (auto& v : team) u.push_back({v.second, v.first});
  sort(u.begin(), u.end());
  vector<string> ans;
  for (int i = n - n / 2; i < n; i++) ans.push_back(u[i].second);
  sort(ans.begin(), ans.end());
  for (auto& v : ans) printf("%s\n", v.c_str());
}
