h=Hash.new 1 h[$_]*=gets.hex while gets ?$ h.map{|a|puts'%s%x'%a}