a = gets.chomp.split.map(&:to_i) count = Hash.new(0) a.each do |v| count[v] += 1 end three_pair = 0 two_pair = 0 count.each do |key, value| if value == 3 three_pair += 1 elsif value ==2 two_pair += 1 end end if three_pair == 1 and two_pair == 1 puts "FULL HOUSE" elsif three_pair == 1 puts "TRHEE CARD" elsif two_pair == 2 puts "TWO PAIR" elsif two_pair == 1 puts "ONE PAIR" else puts "NO HAND" end