as=STDIN.gets.split(" ") as.size.times do |i| as[i]=as[i].to_i end as.sort! cs=[0,0,0,0,0,0] point=0 4.times do |i| if as[i]==as[i+1] cs[point]+=1 else if cs[point]>0 point+=1 end end end cs.sort!.reverse! if cs[0]==2 && cs[1]==1 puts "FULL HOUSE" elsif cs[0]==2 puts "THREE CARD" elsif cs[0]==1 && cs[1]==1 puts "TWO PAIR" elsif cs[0]==1 puts "ONE PAIR" else puts "NO HAND" end