def adj_matrix(array)
	result = Array.new(array.length) {Array.new(array.length, 0)};
	
	for i in 0..(array.length-1)
		if(array[i][1] != 0)
			for j in 2..(array[i].length-1)
				result[(array[i][0])-1][(array[i][j])-1] = 1
			end
		end
	end

	for k in 0..(result.length-1)
		puts result[k].join(" ")
	end
end

n = gets.chomp.to_i
a = []
for i in 0..(n-1)
	a << gets.chomp.split().map(&:to_i)
end

adj_matrix(a);