#include using namespace std; struct abc{ string team; int p,g; }a[5]; bool comp(abc x,abc y) { if(x.p!=y.p)return x.p < y.p; else if(x.g!=y.g)return x.g < y.g; else return x.team.compare(y.team) < 0; } string s1,s2; int main() { int x,y,xx,yy,nr=0,ok1,okk; for(int i=1;i<=6;i++) { cin>>s1>>s2>>x>>y; xx=x;yy=y; if(x==y)x=y=1; else if(x>y)x=3,y=0; else y=3,x=0; ok1=okk=0; for(int j=1;j<=nr;j++) { if(a[j].team.compare(s1)==0)a[j].p+=x,a[j].g+=xx,ok1++; else if(a[j].team.compare(s2)==0)a[j].p+=y,a[j].g+=yy,okk++; } if(ok1==0) { ++nr; a[nr].team=s1; a[nr].p=x; a[nr].g=xx; } if(okk==0) { ++nr; a[nr].team=s2; a[nr].p=y; a[nr].g=yy; } } sort(a+1,a+nr+1,comp); for(int i=nr;i>=1;i--)cout<