def form(a)
	a.each_with_index do |val,i|
		print val
		if i == $n - 1
			print "\n"
		else
			print " "
		end
	end
end

$n = gets.chomp.to_i
l=[]
$n.times do 
	u, k, *v = gets.chomp.split(" ").map(&:to_i)
	l[u] = v
end

m=Array.new($n+1){Array.new($n, 0)}

l.each_with_index do |arr,i|
	if arr == nil
		m[i] = nil
		next
	end
	arr.each do |val|
		m[i][val-1] = 1
	end
end

m.each do |a|
	form(a) if a
end
