#include <bits/stdc++.h>
using namespace std;
int n, g1, g2;
char c;
map<string, int> sc, gm, g;
string s, n1, n2, name[55];
bool cmp(string s1, string s2) {
  if (sc[s1] != sc[s2]) return sc[s1] > sc[s2];
  if (gm[s1] != gm[s2]) return gm[s1] > gm[s2];
  return g[s1] > g[s2];
}
int main() {
  cin >> n;
  for (int k = 0; k < n; k++) cin >> name[k];
  for (int k = 0; k < (n * (n - 1) / 2); k++) {
    cin >> s >> g1 >> c >> g2;
    n1 = s.substr(0, s.find('-'));
    n2 = s.substr(s.find('-') + 1);
    if (g1 > g2)
      sc[n1] += 3;
    else if (g1 == g2)
      sc[n1]++, sc[n2]++;
    else
      sc[n2] += 3;
    g[n1] += g1, g[n2] += g2;
    gm[n1] += g1 - g2, gm[n2] += g2 - g1;
  }
  sort(name, name + n, cmp);
  sort(name, name + n / 2);
  cout << name[0];
  for (int i = 1; i < (n / 2); i++) cout << "\n" << name[i];
  return 0;
}
