#include <bits/stdc++.h>
using namespace std;
const long double eps = 1E-2;
const int pinf = 1E+9;
const int minf = 1E-9;
template <typename T>
inline T sqr(T _k) {
  return _k * _k;
}
class compare {
 public:
  bool operator()(const pair<int, pair<int, pair<int, string> > > &p1,
                  const pair<int, pair<int, pair<int, string> > > &p2) const {
    return (p1.first > p2.first                               ? true
            : p1.first < p2.first                             ? false
            : p1.second.first > p2.second.first               ? true
            : p1.second.first < p2.second.first               ? false
            : p1.second.second.first > p2.second.second.first ? true
            : p1.second.second.first < p2.second.second.first
                ? false
                : p1.second.second.second > p2.second.second.second);
  }
};
class cmpname {
 public:
  bool operator()(const pair<int, pair<int, pair<int, string> > > &p1,
                  const pair<int, pair<int, pair<int, string> > > &p2) const {
    return (p1.second.second.second < p2.second.second.second);
  }
};
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  string t1, t2;
  int sc1, sc2;
  map<string, int> teams;
  vector<pair<int, pair<int, pair<int, string> > > > score(n);
  sc1 = 0;
  for (int i = 0; i < n; ++i) {
    cin >> t1;
    teams.insert(make_pair(t1, sc1++));
  }
  for (int i = 0; i < n * (n - 1) / 2; ++i) {
    getline(cin, t1, '-');
    t1.erase(t1.begin());
    cin >> t2 >> sc1;
    cin.get();
    cin >> sc2;
    score[teams[t1]] = make_pair(
        score[teams[t1]].first + (sc1 > sc2    ? 3
                                  : sc1 == sc2 ? 1
                                               : 0),
        make_pair(score[teams[t1]].second.first + sc1 - sc2,
                  make_pair(score[teams[t1]].second.second.first + sc1, t1)));
    score[teams[t2]] = make_pair(
        score[teams[t2]].first + (sc1 < sc2    ? 3
                                  : sc1 == sc2 ? 1
                                               : 0),
        make_pair(score[teams[t2]].second.first + sc2 - sc1,
                  make_pair(score[teams[t2]].second.second.first + sc2, t2)));
  }
  sort(score.begin(), score.end(), compare());
  sort(score.begin(), score.begin() + n / 2, cmpname());
  for (int i = 0; i < n / 2; ++i) cout << score[i].second.second.second << endl;
  return 0;
}
