a=gets.split.map &:to_i b=(a|[]).map{|e|a.count e}.sort puts b[-2,2]==[2,3]?'FULL HOUSE':b[-1]==3?'THREE HAND':b[-2,2]==[2,2]?'TWO PAIR':b[-1]==2?'ONE PAIR':'NO HAND'