#include <bits/stdc++.h>
int main() {
  int n, i, c, j, times;
  scanf("%d", &n);
  struct team {
    char name[30];
    int score;
    int gl;
    int dgl;
  };
  struct team teams[n];
  for (i = 0; i < n; i++) {
    scanf("%s", teams[i].name);
    teams[i].score = 0;
    teams[i].gl = 0;
    teams[i].dgl = 0;
  }
  times = n * (n - 1) / 2;
  for (i = 0; i < times; i++) {
    c = 0, j = 0;
    int s1, s2, x, y;
    char team1[31], team2[31], s[62], num[7];
    scanf("%s", s);
    scanf("%s", num);
    while (s[j] != '-') {
      team1[j] = s[j];
      j++;
    }
    team1[j] = '\0';
    j++;
    while (s[j] != '\0') {
      team2[c] = s[j];
      c++;
      j++;
    }
    team2[c] = '\0';
    char* dot;
    dot = strchr(num, ':');
    s1 = strtoul(num, &dot, 0);
    s2 = atoi(dot + 1);
    x = -1, y = -1;
    for (j = 0; j < n; j++) {
      if (!strcmp(team1, teams[j].name)) {
        x = j;
      }
      if (!strcmp(team2, teams[j].name)) {
        y = j;
      }
      if (x != -1 && y != -1) {
        break;
      }
    }
    if (s1 > s2) {
      teams[x].score += 3;
    } else if (s2 > s1) {
      teams[y].score += 3;
    } else if (s2 == s1) {
      teams[x].score++;
      teams[y].score++;
    }
    teams[x].gl += s1;
    teams[y].gl += s2;
    teams[x].dgl += s1 - s2;
    teams[y].dgl += s2 - s1;
  }
  struct team win[25];
  int size = 0;
  for (i = 0; i < n / 2; i++) {
    int k = i;
    struct team tem = teams[i];
    for (j = i; j < n; j++) {
      if (tem.score < teams[j].score) {
        tem = teams[j];
        k = j;
      } else if (tem.score == teams[j].score) {
        if (tem.dgl < teams[j].dgl) {
          tem = teams[j];
          k = j;
        } else if (tem.dgl == teams[j].dgl) {
          if (tem.gl < teams[j].gl) {
            tem = teams[j];
            k = j;
          }
        }
      }
    }
    tem = teams[i];
    teams[i] = teams[k];
    teams[k] = tem;
    win[size++] = teams[i];
  }
  for (i = 0; i < size; i++)
    for (j = 0; j < size - i - 1; j++)
      if (strcmp(win[j].name, win[j + 1].name) > 0) {
        struct team tem = win[j];
        win[j] = win[j + 1];
        win[j + 1] = tem;
      }
  for (i = 0; i < size; i++) printf("%s\n", win[i].name);
  return 0;
}
