CONNECTED = 1

# Get matrix size
n = gets.to_i

# Initialize matrix
matrix = n.times.map{[0] * n}


STDIN.read.each_line{|line|
  node, _, *nodes = line.split(' ').map(&:to_i)

  nodes.each{|j|
    matrix[node-1][j-1] = CONNECTED
  }
}

# Print matrix
matrix.each{|row|
  puts(row.join(' '))
}

