a=gets.split.group_by{|a|a}.map(&:last).map(&:size).sort.reverse b={[3,2] => "FULL HOUSE", [3,1] => "THREE CARD", [2,2] => "TWO PAIR", [2,1] => "ONE PAIR"} puts b[a[0..1]]||"NO HAND"