#include <bits/stdc++.h>
using namespace std;
typedef struct team {
  char name[31];
  int mark;
  int goal_difference;
  int goals;
} team;
bool compare(char* p1, char* p2) {
  int i = 0;
  while (p1[i] == p2[i]) i++;
  return p1[i] < p2[i];
}
int main(void) {
  char name1[31], name2[31], in[100], name[25][31];
  team temp, t[50];
  int m1, m2, mark1, mark2, times1, times2, n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i].name;
    t[i].mark = t[i].goal_difference = t[i].goals = 0;
  }
  getchar();
  for (int i = 0; i < n * (n - 1) / 2; i++) {
    mark1 = mark2 = 0;
    times1 = times2 = 0;
    gets(in);
    int j = 0, k = 0;
    while (in[j] != '-') {
      name1[j] = in[j];
      j++;
    }
    name1[j++] = '\0';
    while (in[j] != ' ') {
      name2[k++] = in[j];
      j++;
    }
    name2[k] = '\0';
    for (int q = 0; q < n; q++) {
      if (!strcmp(name1, t[q].name)) m1 = q;
      if (!strcmp(name2, t[q].name)) m2 = q;
    }
    while (in[j] != ':') j++, times1++;
    for (times1--; times1 > 0; times1--) {
      mark1 += (in[j - times1] - '0') * pow(10, times1 - 1);
    }
    while (in[j] != '\0') j++, times2++;
    for (times2--; times2 > 0; times2--) {
      mark2 += (in[j - times2] - '0') * pow(10, times2 - 1);
    }
    if (mark1 > mark2)
      t[m1].mark += 3;
    else if (mark1 == mark2)
      t[m1].mark += 1, t[m2].mark += 1;
    else
      t[m2].mark += 3;
    t[m1].goal_difference += mark1 - mark2;
    t[m2].goal_difference += mark2 - mark1;
    t[m1].goals += mark1, t[m2].goals += mark2;
  }
  for (int g = 0; g < n / 2 + 1; g++) {
    for (int h = n - 1; h > g; h--) {
      if (t[h].mark > t[h - 1].mark) {
        temp = t[h];
        t[h] = t[h - 1];
        t[h - 1] = temp;
      } else if (t[h].mark == t[h - 1].mark) {
        if (t[h].goal_difference > t[h - 1].goal_difference) {
          temp = t[h];
          t[h] = t[h - 1];
          t[h - 1] = temp;
        } else if (t[h].goal_difference == t[h - 1].goal_difference) {
          if (t[h].goals > t[h - 1].goals) {
            temp = t[h];
            t[h] = t[h - 1];
            t[h - 1] = temp;
          }
        }
      }
    }
  }
  for (int i = 0; i < n / 2; i++) strcpy(name[i], t[i].name);
  for (int i = 0; i < n / 2 - 1; i++) {
    for (int j = 0; j < n / 2 - 1 - i; j++) {
      int k = 0;
      while (name[j][k] == name[j + 1][k]) k++;
      if (name[j][k] > name[j + 1][k]) {
        strcpy(name1, name[j]);
        strcpy(name[j], name[j + 1]);
        strcpy(name[j + 1], name1);
      }
    }
  }
  for (int i = 0; i < n / 2; i++) cout << name[i] << endl;
  return 0;
}
