#include <bits/stdc++.h>
using namespace std;
struct table {
  string nm;
  int pt, gf, ga;
};
bool cmp(table a, table b) {
  if (a.pt == b.pt) {
    if ((a.gf - a.ga) == (b.gf - b.ga)) {
      return a.gf > b.gf;
    }
    return (a.gf - a.ga) > (b.gf - b.ga);
  }
  return a.pt > b.pt;
}
int main() {
  string str, st1, st2;
  char str1[100], str2[100], str3[100];
  int j, n, i, a, b;
  cin >> n;
  table tm[100];
  for (i = 0; i < n; i++) {
    cin >> str;
    tm[i].nm = str;
    tm[i].pt = 0;
    tm[i].gf = 0;
    tm[i].ga = 0;
  }
  gets(str1);
  for (j = 0; j < n * (n - 1) / 2; j++) {
    gets(str1);
    for (i = 0; i < strlen(str1); i++)
      if (str1[i] == '-') str1[i] = ' ';
    sscanf(str1, "%s %s %ld:%ld", str2, str3, &a, &b);
    st1 = str2;
    st2 = str3;
    if (a == b)
      for (i = 0; i < n; i++) {
        if (st1 == tm[i].nm) {
          tm[i].pt += 1;
          tm[i].gf += a;
          tm[i].ga += b;
        }
        if (st2 == tm[i].nm) {
          tm[i].pt += 1;
          tm[i].gf += a;
          tm[i].ga += b;
        }
      }
    else if (a >= b)
      for (i = 0; i < n; i++) {
        if (st1 == tm[i].nm) {
          tm[i].pt += 3;
          tm[i].gf += a;
          tm[i].ga += b;
        }
        if (st2 == tm[i].nm) {
          tm[i].pt += 0;
          tm[i].gf += b;
          tm[i].ga += a;
        }
      }
    else
      for (i = 0; i < n; i++) {
        if (st1 == tm[i].nm) {
          tm[i].pt += 0;
          tm[i].gf += a;
          tm[i].ga += b;
        }
        if (st2 == tm[i].nm) {
          tm[i].pt += 3;
          tm[i].gf += b;
          tm[i].ga += a;
        }
      }
  }
  string str0[100];
  sort(tm, tm + n, cmp);
  for (i = 0; i < n / 2; i++) {
    str0[i] = tm[i].nm;
  }
  sort(str0, str0 + n / 2);
  for (i = 0; i < n / 2; i++) cout << str0[i] << endl;
  return 0;
}
