n = gets.chomp.to_i
m = []
n.times do
  as = gets.chomp.split.map(&:to_i)
  a = as[0]
  xs = as.drop(2)
  m[a] = []
  for x in xs
    m[a][x] = 1
  end
end

for i in 1..n
  for j in 1..n
    x = if m[i][j].nil?
      print 0
    else
      print 1
    end
    print x.to_s
    print " " if j != n
  end
  print "\n"
end