#include <bits/stdc++.h>
using namespace std;
int n;
struct pt {
  string name;
  int points;
  int zab, prop;
};
map<string, pt> s;
inline bool cmp(const pt& p1, const pt& p2) {
  if (p1.points == p2.points) {
    if (p1.zab - p1.prop == p2.zab - p2.prop) {
      return p1.zab > p2.zab;
    }
    return (p1.zab - p1.prop) > (p2.zab - p2.prop);
  }
  return p1.points > p2.points;
}
int main() {
  string buf;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> buf;
  int c = n * (n - 1) / 2;
  for (int i = 0; i < c; ++i) {
    cin >> buf;
    string name1 = "", name2 = "";
    int j = 0;
    while (buf[j] != '-') {
      name1.push_back(buf[j]);
      ++j;
    }
    ++j;
    while (j < (int)buf.size()) {
      name2.push_back(buf[j]);
      ++j;
    }
    int a, b;
    char ch;
    cin >> a >> ch >> b;
    s[name1].zab += a;
    s[name1].prop += b;
    s[name2].zab += b;
    s[name2].prop += a;
    if (a > b) {
      s[name1].points += 3;
    } else {
      if (a == b) {
        ++s[name1].points;
        ++s[name2].points;
      } else
        s[name2].points += 3;
    }
  }
  vector<pt> ans;
  for (map<string, pt>::iterator it = s.begin(); it != s.end(); ++it) {
    ans.push_back((*it).second);
    ans.back().name = (*it).first;
  }
  sort(ans.begin(), ans.end(), &cmp);
  vector<string> ans2;
  for (int i = 0; i < n / 2; ++i) ans2.push_back(ans[i].name);
  sort(ans2.begin(), ans2.end());
  for (int i = 0; i < (int)ans2.size(); ++i) cout << ans2[i] << endl;
  return 0;
}
