#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
bool comp(string a, string b) {
  if (a.size() != b.size()) return a.size() < b.size();
  return a < b;
}
bool cmp(int a, int b) { return a > b; }
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
struct team {
  string name;
  int pts, score, miss;
} teams[55];
map<string, int> id;
bool cmp1(team a, team b) {
  if (a.pts != b.pts) {
    return a.pts > b.pts;
  }
  if ((a.score - a.miss) != (b.score - b.miss)) {
    return (a.score - a.miss) > (b.score - b.miss);
  }
  return a.score > b.score;
}
bool cmp2(team a, team b) { return a.name < b.name; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < int(n); i++) {
    string s;
    cin >> s;
    id[s] = i;
    teams[i].name = s;
  }
  int l = n * (n - 1) / 2;
  while (l--) {
    string t1, t2, m;
    char c2;
    int a, b, p = 0;
    cin >> m;
    while (m[p] != '-') t1 += m[p++];
    p++;
    while (m[p]) t2 += m[p++];
    cin >> a >> c2 >> b;
    if (a == b) {
      teams[id[t1]].pts++;
      teams[id[t2]].pts++;
    } else if (a > b) {
      teams[id[t1]].pts += 3;
    } else {
      teams[id[t2]].pts += 3;
    }
    teams[id[t1]].score += a;
    teams[id[t2]].score += b;
    teams[id[t1]].miss += b;
    teams[id[t2]].miss += a;
  }
  sort(teams, teams + n, cmp1);
  n >>= 1;
  sort(teams, teams + n, cmp2);
  for (int i = 0; i < n; i++) {
    cout << teams[i].name << endl;
  }
  return 0;
}
