object Main extends App {
  val n: Int = io.StdIn.readInt()
  val matrix: Array[Array[Int]] = Array.ofDim(n, n)
  for (i <- 0 until n) {
    val indices: Array[Int] = io.StdIn.readLine().split(" ").drop(2).map(_.toInt)
    indices foreach (j => matrix(i)(j-1) = 1)
  }
  for (x <- matrix) println(x.mkString(" "))
}
