#include #include #include #include using namespace std; char c[5][101]; pair > v[5]; int nr; void adauga(char *s, int nnr) { int i; for(i=1;i<=nr;i++) if(strcmp(c[i],s)==0) { v[i].second.first+=nnr; return ; } nr++; strcpy(c[nr],s); v[nr].first=nr; v[nr].second.first=nnr; } void adauga2(char *s, int nnr) { int i; for(i=1;i<=nr;i++) if(strcmp(c[i],s)==0) { v[i].second.second+=nnr; return ; } nr++; strcpy(c[nr],s); v[nr].first=nr; v[nr].second.second=nnr; } struct cmp { bool operator () (const pair > a, const pair > b) const { if(a.second.first==b.second.first) { if(a.second.second==b.second.second) return strcmp(c[a.first],c[b.first]); else return a.second.second>b.second.second; } return a.second.first>b.second.first; } }; int main () { char a[101],b[101]; int i,x,y; //freopen("code.in","r",stdin); nr=0; for(i=1;i<=6;i++) { scanf("%s%s%d%d",a,b,&x,&y); if(x>y) adauga(a,3); else if(x