Scanf.scanf "%d" (fun t -> let rec loop i cur = if i = t then "T" else let x = Scanf.scanf " %d" (fun x -> x) in if abs (cur - x) = 1 then loop (i + 1) x else "F" in loop 0 0 |> print_endline )