while~0: c=(raw_input()+' ').count for u in"m kg s A K mol cd".split(): n=c(u+' ')+2*c(u+'2') if n:print u+`n`*(n>1), print