import io.StdIn

object Main {
  def main(argv: Array[String]): Unit = {
    val vertexCount = StdIn.readLine.toInt

    val matrix = new Array[Array[Int]](vertexCount)

    (1 to vertexCount) foreach { n =>
      matrix(n-1) = new Array[Int](vertexCount)
      val line = StdIn.readLine.split(" ").map(_.toInt).toArray
      line.drop(2) foreach { k =>
        matrix(line(0) - 1)(k - 1) = 1
      }
    }

    matrix.foreach { line => println(line.mkString(" ")) }
  }
}

