#include <bits/stdc++.h>
using namespace std;
int n, num1, num2;
string nm[51], a, name1, name2;
char c;
map<string, int> point, win, ball;
struct node {
  string name;
  int point, win, ball;
} T[100];
bool cmp(node a, node b) {
  if (a.point == b.point) {
    if (a.win == b.win)
      return a.ball > b.ball;
    else
      return a.win > b.win;
  } else
    return a.point > b.point;
}
bool cmp2(node a, node b) { return a.name < b.name; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    nm[i] = a;
  }
  for (int i = 1; i <= n * (n - 1) / 2; i++) {
    name1 = "";
    name2 = "";
    num1 = 0;
    num2 = 0;
    while (1) {
      scanf("%c", &c);
      if (c == '-')
        break;
      else if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
        name1 += c;
    }
    while (1) {
      scanf("%c", &c);
      if (c == ' ')
        break;
      else
        name2 += c;
    }
    while (1) {
      scanf("%c", &c);
      if (c == ':')
        break;
      else
        num1 *= 10, num1 += c - '0';
    }
    cin >> num2;
    if (num1 > num2) point[name1] += 3;
    if (num1 == num2) point[name1]++, point[name2]++;
    if (num1 < num2) point[name2] += 3;
    win[name1] += num1 - num2;
    win[name2] += num2 - num1;
    ball[name1] += num1;
    ball[name2] += num2;
  }
  for (int i = 1; i <= n; i++) {
    T[i].name = nm[i];
    T[i].point = point[nm[i]];
    T[i].win = win[nm[i]];
    T[i].ball = ball[nm[i]];
  }
  sort(T + 1, T + n + 1, cmp);
  sort(T + 1, T + n / 2 + 1, cmp2);
  for (int i = 1; i <= n / 2; i++) cout << T[i].name << endl;
}
