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