#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<string, pair<pair<int, int>, int>> mp;
  map<string, pair<pair<int, int>, int>>::iterator it;
  string str;
  for (int i = 0; i < n; i++) {
    cin >> str;
    mp[str].first.first = 0;
    mp[str].first.second = 0;
    mp[str].second = 0;
  }
  for (int i = 0; i < n * (n - 1) / 2; i++) {
    string team1, team2;
    int num1, num2;
    char c;
    cin >> str;
    int j = 0;
    while (str[j] != '-') team1 += str[j++];
    j++;
    while (j < str.length()) team2 += str[j++];
    cin >> num1 >> c >> num2;
    if (num1 > num2) {
      mp[team1].first.first += 3;
    }
    if (num1 < num2) {
      mp[team2].first.first += 3;
    }
    if (num1 == num2) {
      mp[team1].first.first++;
      mp[team2].first.first++;
    }
    mp[team1].first.second += num1 - num2;
    mp[team1].second += num1;
    mp[team2].first.second += num2 - num1;
    mp[team2].second += num2;
  }
  vector<pair<pair<pair<int, int>, int>, string>> v;
  for (it = mp.begin(); it != mp.end(); it++) {
    v.push_back(make_pair((*it).second, (*it).first));
  }
  sort(v.begin(), v.end());
  set<string> st;
  set<string>::iterator its;
  for (int i = n / 2; i < n; i++) st.insert(v[i].second);
  for (its = st.begin(); its != st.end(); ++its) cout << *its << endl;
  return 0;
}
