#include<bits/stdc++.h>
using namespace std;
struct SORT {
int g, l, p;
string name;
} s[65];
unordered_map<string, int> goal, lose, pts;
string name[65];
bool cmp(SORT x, SORT y) {
if (x.p != y.p) {
return x.p > y.p;
} else {
if (x.l != y.l) {
return x.l > y.l;
} else {
return x.g > y.g;
}
}
}
bool cmp2(SORT x, SORT y) {
return x.name < y.name;
}
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string na;
cin >> na;
name[i] = na;
goal[na] = 0;
lose[na] = 0;
pts[na] = 0;
}
// cout << "TEAM END\n";
for (int i = 1; i <= (n * (n - 1) / 2); i++) {
char c;
string s1, s2;
while (1) {
scanf("%c", &c);
if (c == '-')break;
else if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))s1 += c;
}
while (1) {
scanf("%c", &c);
if (c == ' ')break;
else
s2 += c;
}
int x, y;
scanf("%d:%d", &x, &y);
// cout << x << '-' << y << ' ';
goal[s1] += x;
lose[s1] += (x - y);
goal[s2] += y;
lose[s2] += (y - x);
if (x == y) {
pts[s1] += 1;
pts[s2] += 1;
// cout<<"TIE\n";
}
if (x > y) {
pts[s1] += 3;
// cout<<"LEFT WIN\n";
}
if (x < y) {
pts[s2] += 3;
// cout<<"RIGHT WIN\n";
}
}
for (int i = 1; i <= n; i++) {
s[i].name = name[i];
s[i].g = goal[name[i]];
s[i].l = lose[name[i]];
s[i].p = pts[name[i]];
}
sort(s + 1, s + n + 1, cmp);
sort(s + 1, s + (n / 2) + 1, cmp2);
for (int i = 1; i <= n / 2; i++) {
cout << s[i].name << endl;
}
return 0;
}
rt