import Data.List main :: IO () main = interact $ solve . sort . map read . words solve :: [Int] -> String solve [a,b,c,d,e] | a == b && b == c && c /= d && d == e = "FULL HOUSE" | a == b && b /= c && c == d && d == e = "FULL HOUSE" | a == b && b == c && c /= d && d /= e = "THREE CARD" | a /= b && b == c && c == d && d /= e = "THREE CARD" | a /= b && b /= c && c == d && d == e = "THREE CARD" | a == b && b /= c && c == d && d /= e = "TWO PAIR" | a == b && b /= c && c /= d && d == e = "TWO PAIR" | a /= b && b == c && c /= d && d == e = "TWO PAIR" | a == b && b /= c && c /= d && d /= e = "ONE PAIR" | a /= b && b == c && c /= d && d /= e = "ONE PAIR" | a /= b && b /= c && c == d && d /= e = "ONE PAIR" | a /= b && b /= c && c /= d && d == e = "ONE PAIR" | otherwise = "NO HAND"