let readln_t2_by f =
  let ( @@ ) lst n = List.nth lst n in
  read_line ()
  |> Str.split (Str.regexp_string " ")
  |> List.map f
  |> fun lst -> (lst @@ 0, lst @@ 1)



let solve n arr =
  let tbl = Hashtbl.create n
  and ans = Bytes.make (n - 1) '0'
  in
  Hashtbl.add tbl (n - 1) false;

  let rec solve' idx =
    if idx < 0 then ()
    else
    (
      let buy_flg =
        List.exists (fun b -> not (Hashtbl.find tbl b)) arr.(idx)
      in
      Hashtbl.add tbl idx buy_flg;
      if buy_flg then (Bytes.set ans (n - 2 - idx) '1');
      solve' (idx - 1)
    )
  in
  solve' (n - 2);
  let sidx = Bytes.index ans '1' in
  Bytes.sub_string ans sidx (n - 1 - sidx)

let () =
  let n, m = readln_t2_by int_of_string in
  let ab_arr = Array.make (n - 1) []
  and ab_st = Stream.from (
    fun i ->
      if i < m then
        let a, b = readln_t2_by int_of_string in
        Some(a, b)
      else None)
  in
  Stream.iter (fun (a, b) -> ab_arr.(a) <- b :: ab_arr.(a)) ab_st;
  solve n ab_arr |> print_endline