#include #include using namespace std; struct team { string a; int points,goals; } A[6]; string s1,s2; int k,goals1,goals2,rez1,rez2; bool cmp(team A, team B) { if (A.points==B.points) { if (A.goals==B.goals) return A.aB.goals; } return A.points>B.points; } int main() { int i,j; for (i=0;i<6;++i) { cin>>s1>>s2>>goals1>>goals2; if (goals1==goals2) rez1=rez2=1; else { if (goals1>goals2) rez1=3, rez2=0; else rez1=0, rez2=3; } for (j=1;j<=k;++j) if (A[j].a==s1) { A[j].goals+=goals1; A[j].points+=rez1; break; } if (j>k) { A[++k].a=s1; A[k].goals=goals1; A[k].points=rez1; } for (j=1;j<=k;++j) if (A[j].a==s2) { A[j].goals+=goals2; A[j].points+=rez2; break; } if (j>k) { A[++k].a=s2; A[k].goals=goals2; A[k].points=rez2; } } sort(A+1,A+5,cmp); for (i=1;i<=4;++i) cout<