a=map(str.split,open('../fd/0')) for _,g,s,b,n in sorted([`v`.count(e)for v in[a]+zip(*a)]+[e]for e in a.pop(0))[::-1]:print n,g,s,b