import scala.io.StdIn.{readLine, readInt};
object Main {
    def main(args: Array[String]): Unit = {
        val size = readInt;
        val am = new AdjacencyMatrices(size);
        (0 until size).foreach { i =>
            readLine.split(" ").map(_.toInt).toList match {
                case src :: num :: dsts => am.build(src, dsts);
                case _ => ();
            }
        }
        am.dump();
    }
}
class AdjacencyMatrices(size: Int) {
    val matrix = Array.ofDim[Int](size + 1, size + 1);
    def build(src: Int, dst: Seq[Int]): Unit = dst.foreach { i => matrix(src)(i) = 1 };
    def dump(): Unit = matrix.tail.foreach { dsts => println(" " + dsts.tail.mkString(" "))};
}
