fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: 0
    val matrix = Array(n){IntArray(n)}
    for (i in 0 until n) {
        val input = readLine()?.split(" ".toRegex())?.map(String::toInt) ?: return
        if (input[1] > 0) {
            input.subList(2, 2 + input[1]).forEach {
                matrix[input[0] - 1][it - 1] = 1
            }
        }
    }
    println(matrix.joinToString("\n") {
        it.joinToString(" ")
    })
}
