n = int(input())
scores = {}
for i in range(n):
tName = input()
scores[tName] = [0, 0, 0]
desLen = int(n*(n-1)/2)
for i in range(desLen):
gameDes = input()
sepDes = gameDes.split(' ')
sepT = sepDes[0].split('-')
sepS = sepDes[1].split(':')
scores[sepT[0]][2] = scores[sepT[0]][2] + int(sepS[0])
scores[sepT[1]][2] = scores[sepT[1]][2] + int(sepS[1])
if int(sepS[0]) > int(sepS[1]):
scores[sepT[0]][0] = scores[sepT[0]][0] + 3
scores[sepT[0]][1] = scores[sepT[0]][1] + \
(int(sepS[0]) - int(sepS[1]))
scores[sepT[1]][1] = scores[sepT[1]][1] + \
(int(sepS[1]) - int(sepS[0]))
elif int(sepS[0]) < int(sepS[1]):
scores[sepT[1]][0] = scores[sepT[1]][0] + 3
scores[sepT[1]][1] = scores[sepT[1]][1] + \
(int(sepS[1]) - int(sepS[0]))
scores[sepT[0]][1] = scores[sepT[0]][1] + \
(int(sepS[0]) - int(sepS[1]))
else:
scores[sepT[0]][0] = scores[sepT[0]][0] + 1
scores[sepT[1]][0] = scores[sepT[1]][0] + 1
valArr = sorted(scores.values(), reverse=True)
keyArr = []
for i in range(0, int(len(valArr)/2)):
keyArr.append(list(scores.keys())[
list(scores.values()).index(valArr[i])])
for i in sorted(keyArr):
print(i)
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
struct perf{std::string name; long pts, diff, scored;};
bool perfCompare(perf a, perf b){
if(a.pts > b.pts){return true;}
else if(a.pts == b.pts && a.diff > b.diff){return true;}
else if(a.pts == b.pts && a.diff == b.diff && a.scored > b.scored){return true;}
return false;
}
int main(){
long n; std::cin >> n;
std::map<std::string, perf> m;
for(long p = 0; p < n; p++){
std::string s; std::cin >> s;
m[s].name = s; m[s].pts = m[s].diff = m[s].scored = 0;
}
for(long p = 0; p < n * (n - 1) / 2; p++){
std::string names, goals; std::cin >> names >> goals;
std::string xn(""), yn(""); bool dash(0);
for(long p = 0; p < names.size(); p++){
if(names[p] == '-'){dash = true;}
else if(dash){yn += names[p];}
else{xn += names[p];}
}
long xg(0), yg(0); bool colon(0);
for(long p = 0; p < goals.size(); p++){
if(goals[p] == ':'){colon = true;}
else if(colon){yg = 10 * yg + (goals[p] - '0');}
else{xg = 10 * xg + (goals[p] - '0');}
}
m[xn].scored += xg; m[yn].scored += yg;
m[xn].diff += xg - yg; m[yn].diff += yg - xg;
if(xg > yg){m[xn].pts += 3;}
else if(xg < yg){m[yn].pts += 3;}
else {m[xn].pts += 1; m[yn].pts += 1;}
}
std::vector<perf> v;
for(std::map<std::string, perf>::iterator it = m.begin(); it != m.end(); it++){v.push_back(it->second);}
sort(v.begin(), v.end(), perfCompare);
std::vector<std::string> res(n / 2); for(long p = 0; p < n / 2; p++){res[p] = v[p].name;}
sort(res.begin(), res.end());
for(long p = 0; p < res.size(); p++){std::cout << res[p] << std::endl;}
return 0;
}
298B - Sail | 239A - Two Bags of Potatoes |
1704E - Count Seconds | 682A - Alyona and Numbers |
44A - Indian Summer | 1133C - Balanced Team |
1704A - Two 0-1 Sequences | 1467A - Wizard of Orz |
1714E - Add Modulo 10 | 1714A - Everyone Loves to Sleep |
764A - Taymyr is calling you | 1714B - Remove Prefix |
1264F - Beautiful Fibonacci Problem | 52A - 123-sequence |
1543A - Exciting Bets | 1714D - Color with Occurrences |
215B - Olympic Medal | 1445A - Array Rearrangment |
1351A - A+B (Trial Problem) | 935B - Fafa and the Gates |
1291A - Even But Not Even | 1269A - Equation |
441A - Valera and Antique Items | 1702C - Train and Queries |
816B - Karen and Coffee | 838D - Airplane Arrangements |
148B - Escape | 847G - University Classes |
1110A - Parity | 1215B - The Number of Products |