N = gets.to_i
adMat = Array.new(N){ Array.new(N,0) }
N.times do
  data = gets.split.map(&:to_i)
  id = data[0]
  counter = data[1] - 1
  0.upto(counter) do |j|
     adMat[id-1][data[j+2]-1] += 1
  end
end
adMat.each do |elem|
  puts elem.join(" ")
end