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