u=open('../fd/0').read().split() for y,x in sorted([[~9L-u[i::i/6].count(x)for i in-1,20,21,22],x]for x in set(u)):print x+`y`[6::3]