n = gets.to_i
m = Array.new(n)
for i in 0..n-1
  m[i] = Array.new(n,0)
end
for i in 0..n-1
  temp = gets.chomp.split(" ").map(&:to_i)
  if temp[1] != 0
    for j in 0..temp[1]-1
      m[i][temp[j+2]-1] = 1
    end
  end
end
m.each do |r|
  puts r.join(" ")
end