h = Hash.new{0} gets.chomp.chars.each{|c| h[c] += 1} if h.values.count(1) == 1 && h.values.count(2) == 6 puts h.key 1 else puts "Impossible" end