let () =
  let n = Scanf.scanf "%d\n" (fun x->x) in
  let adj = Array.init n (fun x -> Array.make n 0) in
  let rec read = function
      0 -> ()
    | i ->
       let (u,k) = Scanf.scanf "%d %d " (fun x y -> (x,y)) in
       let rec loop = function
           0 -> ()
         | j ->
            let v = Scanf.scanf "%d " (fun x -> x) in
            adj.(u-1).(v-1) <- 1;loop (j-1)
       in loop k;read (i-1)
  in read n;
     for i = 0 to n-1 do
       for j = 0 to n-1 do
         print_int adj.(i).(j);
         if j <> n-1 then print_string " "
       done;
       print_newline ()
     done
;;