open System let N, M = Console.ReadLine().Split() |> Array.map int |> fun a -> a.[0], a.[1] let graph : (int list) array = Array.create N [] let marked = Array.create N false for _ in 1 .. M do let u, v = Console.ReadLine().Split() |> Array.map int |> fun a -> a.[0], a.[1] graph.[u] <- v :: graph.[u] graph.[v] <- u :: graph.[v] for i in N - 1 .. -1 .. 0 do if graph.[i] |> List.exists (fun j -> j > i && not marked.[j]) then marked.[i] <- true marked |> Array.rev |> Array.skipWhile (fun x -> not x) |> Array.map (fun x -> if x then "1" else "0") |> System.String.Concat |> Console.WriteLine