#include #include #include #include using namespace std; struct st { int p,g; string s; } a[10]; bool cmp(st a,st b) { return ((a.p>b.p) || ((a.p==b.p) && (a.g>b.g)) || ((a.p==b.p) && (a.g==b.g) && (a.s m; string s,t; int x,y,i,k; int main() { for (i=1;i<=6;i++) { cin >> s >> t >> x >> y; if (m.find(s)==m.end()) { m[s]=++k; a[k].s=s; } if (m.find(t)==m.end()) { m[t]=++k; a[k].s=t; } a[m[s]].g+=x; a[m[t]].g+=y; if (x>y) { a[m[s]].p+=3; } else if (y>x) { a[m[t]].p+=3; } else { a[m[s]].p+=1; a[m[t]].p+=1; } } sort(a+1,a+5,cmp); for (i=1;i<=4;i++) cout << a[i].s << "\n"; }