b[9999],*p;c(a,b){p=strlen(a)-strlen(b)?:strcmp(a,b);}main(){for(p=b;gets(p);p+=9);qsort(b,(p-b)/9,36,c);for(p=b;*p;p+=9)puts(p);}