n = gets.to_i

array = Array.new(n).map{Array.new(n, 0)}

n.times do
  input = gets.split(" ").map{|x| x.to_i}
  u = input.shift
  k = input.shift
  input.each do |i|
    array[u-1][i-1] = 1
  end
end

array.each do |i|
  i.each_with_index do |j, t|
    print j
    print (" ") if t != n-1
  end
  puts
end

