#include <bits/stdc++.h>
using namespace std;
struct Team {
  string name;
  int fi, se, th;
} t[60];
int cmp(Team a, Team b) {
  if (a.fi != b.fi)
    return a.fi > b.fi;
  else if (a.se != b.se)
    return a.se > b.se;
  else
    return a.th > b.th;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i].name;
    t[i].fi = t[i].se = t[i].th = 0;
  }
  for (int i = 0; i < n * (n - 1) / 2; i++) {
    string te, t1, t2;
    int a, b;
    char ch;
    cin >> te >> a >> ch >> b;
    t1 = te.substr(0, te.find('-'));
    t2 = te.substr(te.find('-') + 1);
    for (int j = 0; j < n; j++) {
      if (t[j].name == t1) {
        if (a > b)
          t[j].fi += 3;
        else if (a == b)
          t[j].fi += 1;
        t[j].se += a - b;
        t[j].th += a;
      }
      if (t[j].name == t2) {
        if (a < b)
          t[j].fi += 3;
        else if (a == b)
          t[j].fi += 1;
        t[j].se += b - a;
        t[j].th += b;
      }
    }
  }
  string ans[30];
  sort(t, t + n, cmp);
  for (int i = 0; i < n / 2; i++) ans[i] = t[i].name;
  sort(ans, ans + n / 2);
  for (int i = 0; i < n / 2; i++) cout << ans[i] << endl;
  return 0;
}
