n = STDIN.gets.to_i
m = []
n.times.each {
  as = STDIN.gets.split(' ').map { |x| x.to_i }
  a = as[0]
  xs = as.drop(2)
  m[a] = []
  for x in xs
    m[a][x] = 1
  end
}

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