n=gets.to_i;
a=Array.new(n){Array.new(n,0)}
m=Array.new
n.times do |i|
  m.clear
  m=gets.split.map{|i|i.to_i}
  m[1].times do |j|
    a[m[0]-1][m[j+2]-1]=1
  end
end
n.times do |i|
  (2*n-1).times do|j|
    if j%2==0 then
      print a[i][j/2]
    else
      print " "
    end
  end
  print "\n"
end
