#include <bits/stdc++.h>
using namespace std;
string lower(string line) {
  for (int i = 0; i < line.length(); i++) {
    line[i] =
        (line[i] <= 'Z' && line[i] >= 'A' ? line[i] + 'a' - 'A' : line[i]);
  }
  return line;
}
int main() {
  map<string, int> m;
  string names[50];
  int tp[50] = {0};
  int td[50] = {0};
  int ts[50] = {0};
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string name;
    cin >> name;
    m[name] = i;
    names[i] = name;
  }
  cin.ignore();
  for (int i = 0; i < n * (n - 1) / 2; i++) {
    string name1, name2;
    int score1 = 0;
    int score2 = 0;
    string line;
    getline(cin, line);
    int j = 0;
    for (; line[j] != '-'; j++) name1 += line[j];
    j++;
    for (; line[j] != ' '; j++) name2 += line[j];
    j++;
    for (; line[j] != ':'; j++) score1 = score1 * 10 + (line[j] - '0');
    j++;
    for (; j < line.length(); j++) score2 = score2 * 10 + (line[j] - '0');
    tp[m[name1]] += (score1 > score2 ? 3 : (score1 == score2 ? 1 : 0));
    tp[m[name2]] += (score2 > score1 ? 3 : (score1 == score2 ? 1 : 0));
    td[m[name1]] += score1 - score2;
    td[m[name2]] += score2 - score1;
    ts[m[name1]] += score1;
    ts[m[name2]] += score2;
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      bool sw = false;
      if (tp[i] > tp[j])
        sw = true;
      else if (tp[i] == tp[j] && td[i] > td[j])
        sw = true;
      else if (tp[i] == tp[j] && td[i] == td[j] && ts[i] > ts[j])
        sw = true;
      if (sw) {
        swap(tp[i], tp[j]);
        swap(td[i], td[j]);
        swap(ts[i], ts[j]);
        swap(names[i], names[j]);
      }
    }
  string arr[50];
  int s = 0;
  for (int i = n - 1; i >= n / 2; i--) arr[s++] = names[i];
  for (int i = 0; i < s; i++)
    for (int j = i + 1; j < s; j++)
      if (arr[j] < arr[i]) swap(arr[i], arr[j]);
  for (int i = 0; i < s; i++) cout << arr[i] << endl;
  return 0;
}
