#include #include using namespace std; long n,i,j,ag,bg,nr,ak,bk,ap,bp,v[5],g[5],aux2; char e[5][1001],a[1001],b[1001],aux[1001]; int main() { nr=0; for (j=1;j<=6;j++) { cin>>a; cin>>b; cin>>ag; cin>>bg; if (ag>bg) { ap=3; bp=0; } else if (ag==bg) { ap=1; bp=1; } else { ap=0; bp=3; } ak=bk=0; for (i=1;i<=nr;i++) { if (strcmp(e[i],a)==0) { v[i]+=ap; g[i]+=ag; ak=1; } if (strcmp(e[i],b)==0) { v[i]+=bp; g[i]+=bg; bk=1; } } if (ak==0) { nr++; strcpy(e[nr],a); v[nr]=ap; g[nr]=ag; } if (bk==0) { nr++; strcpy(e[nr],b); v[nr]=bp; g[nr]=bg; } } for (i=1;i0) { aux2=v[i]; v[i]=v[j]; v[j]=aux2; aux2=g[i]; g[i]=g[j]; g[j]=aux2; strcpy(aux,e[i]); strcpy(e[i],e[j]); strcpy(e[j],aux); } } cout<