fun main() { val n = readLine()!!.trim().toInt() for (i in 0 until n) { println((0 until n).map{j -> (i + j) % n + 1 }.joinToString(" ")) } }