#include #include #include using namespace std; char teamA[100], teamB[100]; int scoreA, scoreB, N; struct Team { int points, goals; char name[100]; }T[10000]; bool inA = false, inB = false; int main () { for (int line = 0 ; line< 6; ++line) { scanf("%s %s %d %d", teamA, teamB, &scoreA, &scoreB); if (scoreA < scoreB) { swap(scoreA, scoreB); swap(teamA, teamB); } for (int i=0; i scoreB) T[N].points += 3; else T[N].points += 1; ++N; } if (!inB) { strcpy(T[N].name, teamB); T[N].goals = scoreA; if (scoreA == scoreB) T[N].points += 1; ++N; } } for (int i=0; i 0) swap(T[i], T[j]); } } for (int i=0; i<4; ++i) { printf("%s\n", T[i].name); } return 0; }