#include <bits/stdc++.h>
using namespace std;
const double PI = M_PI;
const int INF = -1 * 1e9;
const long long limit = -1 * 1e16;
const int MOD1 = 1e9 + 711;
const int MOD2 = 1e9 + 933;
const int MOD3 = 1e9 + 993;
const int maxn = 1e6 + 100;
struct Info {
  int points = 0;
  pair<int, int> stat = {0, 0};
  int goals = 0;
};
struct part {
  string name;
  int points = 0;
  pair<int, int> stat = {0, 0};
  int goals = 0;
};
bool cmp(const part &a, const part &b) {
  if (a.points == b.points) {
    if (a.stat.first - a.stat.second == b.stat.first - b.stat.second) {
      return a.goals < b.goals;
    } else {
      return a.stat.first - a.stat.second < b.stat.first - b.stat.second;
    }
  } else {
    return a.points < b.points;
  }
}
int main() {
  cout.tie(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  map<string, Info> p;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    p[s];
  }
  for (int i = 0; i < n * (n - 1) / 2; ++i) {
    string s, a, b;
    int x, y;
    char c;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] != '-') {
        a += s[i];
      } else {
        b = s.substr(i + 1);
        break;
      }
    }
    cin >> x;
    cin >> c;
    cin >> y;
    if (x > y) {
      p[a].points += 3;
    } else if (x == y) {
      p[a].points++;
      p[b].points++;
    } else {
      p[b].points += 3;
    }
    p[a].goals += x;
    p[a].stat.first += x;
    p[a].stat.second += y;
    p[b].goals += y;
    p[b].stat.first += y;
    p[b].stat.second += x;
  }
  vector<part> q;
  for (auto &i : p) {
    part cur;
    cur.name = i.first;
    cur.points = i.second.points;
    cur.goals = i.second.goals;
    cur.stat = i.second.stat;
    q.emplace_back(cur);
  }
  sort(q.rbegin(), q.rend(), cmp);
  vector<string> ans;
  for (int i = 0; i < n / 2; ++i) {
    ans.push_back(q[i].name);
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < n / 2; ++i) {
    cout << ans[i] << '\n';
  }
  cerr << "\n\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
