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_line i j =
    if j < n then begin
      Printf.printf (if j = 0 then "%d" else " %d") a.(i).(j);
      print_line i (j + 1)
    end
  and print i =
    if i < n then begin
      print_line i 0;
      print_newline ();
      print (i + 1)
    end
  in
  print 0