n = gets.chomp.to_i
adjList = []
n.times { adjList.push(gets.chomp.split(' ').map(&:to_i)) }

adjMatrix = Array.new(n){ Array.new(n){ 0 } }

adjList.each do |e|
    next if e[1] == 0
    e[2, e[1]].each do |adj|
        adjMatrix[e[0] - 1][adj - 1] = 1
    end
end

adjMatrix.each { |e| puts(e.join(' ')) }

