#include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define inf (1<<30) ifstream fin ("A.in"); ofstream fout ("A.out"); struct team { string s; int g, p; }v[10]; int n; string s; bool cmp (team a, team b) { if (a.p == b.p) { if (a.g == b.g) return a.s < b.s; return a.g > b.g; } return a.p> b.p; } string s1,s2; int x1,x2; int main() { while (cin>>s1>>s2>>x1>>x2) { int x,y; for (int i = 1; i <= 4; ++i) { if (v[i].s == "") { v[i].s = s1; x = i; break; } else if (v[i].s == s1) { x = i; break; } } for (int i = 1; i <= 4; ++i) { if (v[i].s == "") { v[i].s = s2; y = i; break; } else if (v[i].s == s2) { y = i; break; } } v[x].g += x1; v[y].g += x2; if (x1 > x2) { v[x].p += 3; } else if (x1 == x2) { v[x].p++; v[y].p++; } else v[y].p += 3; } sort (v+1,v+5,cmp); for (int i = 1; i <= 4; ++i) cout<