#include <bits/stdc++.h>
using namespace std;
struct state {
  int p, d, g;
  string s;
  state() { p = d = g = 0; }
  state(const string& s) : s(s) { p = d = g = 0; }
  inline void update(int m, int y) {
    if (m > y)
      p += 3;
    else if (m == y)
      ++p;
    g += m;
    d += m - y;
  }
  inline bool operator<(const state& e) const {
    if (e.p != p) return e.p < p;
    if (e.d != d) return e.d < d;
    if (e.g != g) return e.g < g;
  }
};
int main() {
  int n;
  scanf("%d", &n);
  map<string, int> hs;
  vector<state> res;
  for (int a = 0; a < n; ++a) {
    string s;
    cin >> s;
    hs[s] = a;
    res.push_back(state(s));
  }
  int m = n * (n - 1) / 2;
  while (m--) {
    string x, y;
    cin >> x >> y;
    int pos = x.find('-');
    string F = x.substr(0, pos);
    string S = x.substr(pos + 1);
    pos = y.find(':');
    int g1 = atoi(y.substr(0, pos).c_str());
    int g2 = atoi(y.substr(pos + 1).c_str());
    res[hs[F]].update(g1, g2);
    res[hs[S]].update(g2, g1);
  }
  sort(res.begin(), res.end());
  vector<string> v;
  for (int a = 0; a < n / 2; ++a) v.push_back(res[a].s);
  sort(v.begin(), v.end());
  for (int a = 0; a < v.size(); ++a) puts(v[a].c_str());
  return 0;
}
