#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = (int)1e9;
const double inf1 = 1e-9;
const int ss = (int)1e6 + 3;
bool myf(const pair<char, int>& i, const pair<char, int>& j) {
  return (i.second < j.second);
}
bool pred(const pair<string, pair<int, pair<int, int> > >& i,
          const pair<string, pair<int, pair<int, int> > >& j) {
  if (i.second.first == j.second.first) {
    int x = i.second.second.first - i.second.second.second;
    int y = j.second.second.first - j.second.second.second;
    if (x == y)
      return i.second.second.first > j.second.second.first;
    else
      return x > y;
  } else {
    return (i.second.first > j.second.first);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  cin.get();
  map<string, pair<int, pair<int, int> > > mas;
  string s;
  for (int i = 0; i < n; ++i) {
    getline(cin, s);
    mas.insert(make_pair(s, make_pair(0, make_pair(0, 0))));
  }
  int k = (n - 1) * n / 2;
  string s1, s2;
  int x, y;
  for (int i = 0; i < k; ++i) {
    getline(cin, s1, '-');
    getline(cin, s2, ' ');
    getline(cin, s, ':');
    x = atoi(s.c_str());
    getline(cin, s);
    y = atoi(s.c_str());
    if (x == y) {
      mas[s1].first++;
      mas[s2].first++;
      mas[s1].second.first += x;
      mas[s1].second.second += y;
      mas[s2].second.first += y;
      mas[s2].second.second += x;
    } else {
      if (x > y) {
        mas[s1].first += 3;
        mas[s1].second.first += x;
        mas[s1].second.second += y;
        mas[s2].second.first += y;
        mas[s2].second.second += x;
      } else {
        mas[s2].first += 3;
        mas[s1].second.first += x;
        mas[s1].second.second += y;
        mas[s2].second.first += y;
        mas[s2].second.second += x;
      }
    }
  }
  vector<pair<string, pair<int, pair<int, int> > > > res(n);
  map<string, pair<int, pair<int, int> > >::iterator it;
  int j = 0;
  for (it = mas.begin(); j < n; ++j, ++it) {
    res[j].first = it->first;
    res[j].second = it->second;
  }
  sort(res.begin(), res.end(), pred);
  vector<string> out;
  for (int i = 0; i < n / 2; ++i) out.push_back(res[i].first);
  sort((out).begin(), (out).end());
  for (int i = 0; i < out.size(); ++i) cout << out[i] << endl;
  return 0;
}
