let () =
  let n = read_int () in
  let a = Array.make_matrix n n 0 in
  let rec read i =
    if i < n then begin
      let (id, k) = Scanf.scanf "%d %d " (fun id k -> (id, k)) in
      let rec g j =
        if j < k then (a.(id-1).(Scanf.scanf "%d " (fun i -> i) - 1) <- 1; g (j + 1))
      in g 0;
      read (i + 1)
    end in
  read 0;
  let rec print = function
    | (i, _) when i = n -> ()
    | (i, j) when j = n -> print_newline (); print (i + 1, 0)
    | (i, j) ->
      Printf.printf (if j = 0 then "%d" else " %d") a.(i).(j);
      print (i, j + 1)
  in print (0, 0)