n = gets.to_i
a = Array.new(n).map{Array.new(n,0)}
n.times do
  j = gets.split().map(&:to_i)
  i = 2
  while i < j.size
    a[j[0]-1][j[i]-1] = 1
    # a[j[0]][j[i]] = 1
    i += 1
  end
end
a.each{|i| puts i.join(" ")}
