#include <bits/stdc++.h>
using namespace std;
const int MAXN = 60;
int N;
struct node {
  string name;
  int ball, win, score;
} a[MAXN];
map<string, int> ball, win, score;
bool cmp(node a, node b) {
  if (a.score != b.score) {
    return a.score > b.score;
  }
  if (a.win != b.win) {
    return a.win > b.win;
  }
  if (a.ball != b.ball) {
    return a.ball > b.ball;
  }
}
void solve() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i].name;
    win[a[i].name] = 0;
    ball[a[i].name] = 0;
    score[a[i].name] = 0;
  }
  for (int i = 0; i < N * (N - 1) / 2; i++) {
    int x, y;
    string s;
    cin >> s;
    int pos = s.find('-');
    string t1 = s.substr(0, pos);
    s.erase(0, pos + 1);
    string t2 = s;
    scanf("%d:%d", &x, &y);
    ball[t1] += x;
    ball[t2] += y;
    win[t1] = win[t1] + x - y;
    win[t2] = win[t2] + y - x;
    if (x < y) {
      score[t2] += 3;
    } else if (x == y) {
      score[t1]++;
      score[t2]++;
    } else {
      score[t1] += 3;
    }
  }
  for (int i = 0; i < N; i++) {
    a[i].ball = ball[a[i].name];
    a[i].win = win[a[i].name];
    a[i].score = score[a[i].name];
  }
  sort(a, a + N, cmp);
  vector<string> v;
  for (int i = 0; i < N / 2; i++) {
    v.push_back(a[i].name);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << endl;
  }
}
void Times(int T) {
  while (T--) {
    solve();
  }
}
int main() {
  int T;
  T = 1;
  Times(T);
  return 0;
}
