#include #include #include #include #include using namespace std; struct Solve { string team; int gol, points; }v[10]; int num = 0; int gasit(string team) { //fprintf(stderr,"%s\n",team.c_str()); for (int i = 0; i < num; ++i) { if (team == v[i].team) { return i; } } return -1; } void update(string team1, int points, int gol) { int r = gasit (team1); //printf("%d\n",r); if (r == -1) { v[num].team = team1; v[num].points = points; v[num].gol = gol; ++num; } else { v[r].points += points; v[r].gol += gol; } } bool cmp (Solve a, Solve b) { if (a.points > b.points) { return true; } else if (a.points == b.points) { if (a.gol > b.gol) { return true; } else if (a.gol == b.gol) { return a.team < b.team; } } return false; } int main() { //freopen("date.in","r", stdin); map puncte; map gol; char team1[100], team2[100]; int x,y; int add1 = 0, add2 = 0; for (int i = 0; i < 6; ++i) { scanf("%s %s %d %d\n", team1, team2, &x, &y); if (x < y) { add1 = 0; add2 = 3; } else if (y < x) { add2 = 0; add1 = 3; } else { add2 = 1; add1 = 1; } update(team1, add1, x); update(team2, add2, y); } sort(v, v+num, cmp); for (int i = 0; i < num; ++i) { cout<