n = gets.to_i
graph = Array.new(n){ Array.new(n, 0) }

n.times do
    u, k, *adj = gets.split.map(&:to_i)
    k.times do |i|
      graph[u-1][adj[i]-1] = 1
    end
end
graph.each do |i|
  puts i.join(' ')
end