n = gets.chomp.to_i
ms = Array.new(n){Array.new(n, 0)}
n.times do
  num, degree, *adjacents = gets.chomp.split(' ').map(&:to_i)
  adjacents.each do |a|
    ms[num - 1][a - 1] = 1
  end
end
ms.each do |m|
  puts m.join(' ')
end
