#include <bits/stdc++.h>
using namespace std;
struct node {
  int s, t, z;
  string name;
} a[1200] = {0};
bool cmp(node x, node y) {
  if (x.s == y.s) {
    if (x.t == y.t) {
      return x.z > y.z;
    }
    return x.t > y.t;
  }
  return x.s > y.s;
}
map<string, int> mp;
int main() {
  int i, j, k, n;
  scanf("%d", &n);
  mp.clear();
  for (i = 0; i < n; i++) {
    char q[40] = {0};
    scanf("%s", q);
    a[i].name = string(q);
    mp[a[i].name] = i;
    a[i].s = a[i].t = a[i].z = 0;
  }
  for (i = 0; i < (n * (n - 1)) / 2; i++) {
    char q[40] = {0}, w[40] = {0};
    char qq[80] = {0};
    scanf("%s", qq);
    int pos = strchr(qq, '-') - qq;
    qq[pos] = 0;
    strcpy(q, qq);
    strcpy(w, qq + pos + 1);
    int x = mp[string(q)];
    int y = mp[string(w)];
    int e, r;
    scanf("%d:%d", &e, &r);
    a[x].z += e;
    a[x].t += e - r;
    a[y].z += r;
    a[y].t += r - e;
    if (e > r) {
      a[x].s += 3;
    } else if (e == r) {
      a[x].s++;
      a[y].s++;
    } else {
      a[y].s += 3;
    }
  }
  sort(a, a + n, cmp);
  vector<string> ans;
  ans.clear();
  for (i = 0; i < n / 2; i++) {
    ans.push_back(a[i].name);
  }
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++) {
    puts(ans[i].c_str());
  }
  return 0;
}
