import Data.List main = getLine >>= putStrLn . poker . words poker h | length g == 2 && maximum (map length g) == 3 = "FULL HOUSE" | maximum (map length g) == 3 = "THREE CARD" | length g == 3 = "TWO PAIR" | length g == 4 = "ONE PAIR" | otherwise = "NO HAND" where g = group (sort h)