open System type Sol() = member this.Solve() = let As = stdin.ReadLine().Split() |> Array.map int let hs = As |> Seq.countBy (fun e -> e) |> Seq.sortWith (fun p q -> (snd p).CompareTo(snd q)) |> Seq.rev |> Seq.toArray let judgeHands (ha: (int*int) array) = match (Array.length ha) with | 4 -> "ONE PAIR" | 2 -> if (snd ha.[0]) = 3 then "FULL HOUSE" else "NO HAND" | 3 -> if (snd ha.[0]) = 3 then "THREE CARD" else "TWO PAIR" | _ -> "NO HAND" judgeHands hs |> printfn "%s" let mySol = new Sol() mySol.Solve()