input=gets.split(" ") ans=Array.new() i=0 input.length.to_i.times do ans.push(input.count(input[i]).to_i) i+=1 end if ans.sort==[2,2,3,3,3] puts "FULL HOUSE" elsif ans.sort==[1,2,2,2,2] puts "TWO PAIR" elsif ans.sort==[1,1,3,3,3] puts "THREE CARD" elsif ans.sort==[1,1,1,2,2] puts "ONE PAIR" else puts "NO HAND" end