n = gets.chomp.to_i
matrix = Array.new(n) {Array.new(n, 0)}

n.times do |row|
  inputs = gets.chomp.split.map(&:to_i)
  inputs[1].times do |index|
    matrix[inputs[0]-1][inputs[2+index]-1] = 1
  end
end

matrix.each do |row|
  puts row.join(' ')
end