
let rec split_while f = function
  | [] -> ([],[])
  | hd :: tl -> if f hd then 
                  let (rl, wl) = split_while f tl in (hd :: rl, wl)
                else ([], hd :: tl)

let rec group = function
  | [] -> []
  | hd ::tl -> let (rl, wl) = split_while (fun x -> x = hd) tl in (hd :: rl) :: group wl

let poker lst =
  let is_straight xs =
    let rec iter = function
      | x :: y :: rest when (x + 1) = y -> iter (y :: rest)
      | x :: y :: rest -> false
      | _ -> true in
    if xs = [1;10;11;12;13] then true
    else iter xs in
  if is_straight lst then "straight"
  else match List.map List.length (group lst) with
       | [4;1] | [1;4] -> "four card"
       | [3;2] | [2;3] -> "full house"
       | [3;1;1] | [1;3;1] | [1;1;3] -> "three card"
       | [2;2;1] | [2;1;2] | [1;2;2] -> "two pair"
       | [2;1;1;1] | [1;2;1;1] | [1;1;2;1] | [1;1;1;2] -> "one pair"
       | _ -> "null"

let _ =
  try
    while true do
      let lst = Scanf.scanf "%d,%d,%d,%d,%d\n" (fun v1 v2 v3 v4 v5 -> List.sort compare [v1;v2;v3;v4;v5]) in
      print_endline (poker lst)
    done
  with
    End_of_file -> ()
        