fun main() { val builder = StringBuilder() val n = readInputLine().toInt() val ans = Array(n) { IntArray(n) } for (i in 1..n) { var current = i for (j in i..i + n) { ans[i - 1][(j - 1) % n] = current current-- if (current == 0) { current = n } } } ans.forEach { builder.appendLine(it.joinToString(" ")) } print(builder.toString()) } fun readInputLine(): String { return readLine()!! }