n = gets.to_i

nodes = []

n.times do
  id, k, *vs = gets.chomp.split.map(&:to_i)

  row = Array.new(n + 1, 0)

  nodes[id] = row

  vs.each do |v|
    row[v] = 1
  end
end

puts nodes.compact.map {|row| row.join(' ') }.join("\n")