#include <bits/stdc++.h>
using namespace std;
struct triple {
  int x, y, z, p;
  triple() : x(0), y(0), z(0), p(0) {}
  triple(int x, int y, int z, int p) : x(x), y(y), z(z), p(p) {}
  bool operator<(const triple &S) const {
    if (x != S.x) return x > S.x;
    if (y != S.y) return y > S.y;
    return z > S.z;
  }
};
int main(int argc, char **argv) {
  int N;
  cin >> N;
  map<string, int> D;
  string rD[N];
  vector<triple> res(N);
  for (int i = (0); i < (N); ++i) {
    string s;
    cin >> s;
    D[s] = i;
    rD[i] = s;
    res[i].p = i;
  }
  char line[100000];
  gets(line);
  while (gets(line)) {
    char a[1000], b[1000];
    int sa, sb, pa, push_back;
    sscanf(line, "%[^-]-%s %d:%d", a, b, &sa, &sb);
    pa = D[a], push_back = D[b];
    res[pa].y += sa, res[pa].y -= sb;
    res[push_back].y += sb, res[push_back].y -= sa;
    if (sa > sb) res[pa].x += 3;
    if (sa < sb) res[push_back].x += 3;
    if (sa == sb) res[pa].x++, res[push_back].x++;
    res[pa].z += sa, res[push_back].z += sb;
  }
  sort(res.begin(), res.end());
  vector<string> R;
  for (int i = (0); i < (N / 2); ++i) R.push_back(rD[res[i].p]);
  sort(R.begin(), R.end());
  for (int i = (0); i < (R.size()); ++i) puts(R[i].c_str());
  return 0;
}
