typealias matrix = MutableList<MutableList<Int>>

fun printSquare(latin: matrix) {
    for (row in latin) {
        println(row)
    }
    println()
}

fun latinSquare(n: Int) {
    if (n <= 0) {
        println("[]")
        return
    }

    val latin = MutableList(n) { MutableList(n) { it } }