fun main(args: Array<String>) {
    Main.execute()
}

class Main {

    companion object {
        private val graphMatrix = arrayListOf<ArrayList<Boolean>>()


        fun execute() {

            val num = readLine()!!.toInt()

            initgraph(num)

            for (index in 1..num) {
                val inputs = readLine()!!.split(" ")
                val nodeIndex = inputs[0].toInt()
                for (inputIndex in 2 until inputs.size) {
                    val touchedNode = inputs[inputIndex].toInt()
                    graphMatrix[nodeIndex - 1][touchedNode - 1] = true
                }
            }

            graphMatrix.forEach { it2 ->
                println(it2.joinToString(" ") {
                    if (it) "1" else "0"
                })
            }
        }


        fun initgraph(num: Int) {
            for (i in 0 until num) {
                graphMatrix.add(arrayListOf())
                for (j in 0 until num) {
                    graphMatrix[i].add(false)
                }
            }
        }
    }
}
