#! /usr/bin/ruby -w
# encoding: utf-8
#

class Array
  def disp
    sep = ""
    self.each do |e|
      print sep
      print e
      sep = " "
    end
    puts
  end
end

if $0 == __FILE__
  n = gets.to_i
  g = []
  n.times {
    row = Array.new(n, 0)
    info = gets.split.map(&:to_i)
    outdegree = info[1]
    outdegree.times do |t|
      adj = info[t + 2]
      row[adj - 1] = 1
    end
    g << row
  }
  g.each { |row| row.disp }
end

