package main import "fmt" func main() { var N int fmt.Scan(&N) for i := 0; i < N; i++ { for j := 0; j < N; j++ { if j > 0 { fmt.Print(" ") } fmt.Print(1 + (i+j)%N) } fmt.Println() } }