while 1:c=raw_input().split().count;print' '.join(u+`q`[:q-1]for u in'm kg s A K mol cd'.split()for q in[c(u)+2*c(u+'2')]if q)