#endocing: utf-8

n = gets.rstrip.to_i
map = []
n.times { map << [0] * n}
(1..n).each do |node|
  arr = gets.rstrip.split(/\s/).map(&:to_i)
  u, k = arr[0], arr[1]
  node = arr[2..-1]
  node.each { |v| map[u - 1][v - 1] = 1}
end

map.each do |row|
  puts row.join(" ")
end