import scala.io.StdIn.{readInt, readLine}

object Main {
  def main(args:Array[String]) = {
    val n = readInt
    val adj = Array.ofDim[Int](n,n)
    for(i<-0 until n) {
      val l = readLine.split(" ").map(_.toInt)
      val u = l(0);val k = l(1)
      for(j<-0 until k) {
        val v = l(j+2)
        adj(u-1)(v-1) = 1
      }
    }
    adj.foreach{ e=>println(e.mkString(" ")) }
  }
}