{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"A chessboard like the one below, with six pieces placed on it, such that each row and each column has exactly one piece, and at most one piece on each diagonal (including all parallel lines of the two main diagonals).\n\n![](CDN_BASE_URL/6b9761dfa7626cad08b878efc50550bc?v\u003d1713791147)\n\nThe layout above can be described using a sequence $2\\ 4\\ 6\\ 1\\ 3\\ 5$, where the $i$th number indicates a piece at the corresponding position in the $i$th row, as follows:\n\nRow $1\\ 2\\ 3\\ 4\\ 5\\ 6$\n\nColumn $2\\ 4\\ 6\\ 1\\ 3\\ 5$\n\nThis is just one possible arrangement of the pieces. Please write a program to find all possible arrangements of the pieces. \nOutput them using the sequence method described above, sorted in lexicographical order. \nOutput the first $3$ arrangements. The last line should indicate the total number of arrangements."}},{"title":"Input","value":{"format":"MD","content":"One line with a positive integer $n$, indicating the size of the chessboard, which is $n \\times n$."}},{"title":"Output","value":{"format":"MD","content":"The first three lines are the first three arrangements, with each arrangement\u0027s two numbers separated by a space. The fourth line contains only one number, indicating the total number of arrangements."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 4 6 1 3 5\n3 6 2 5 1 4\n4 1 5 2 6 3\n4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"【Data Limits】 \nFor $100\\%$ data, $6 \\le n \\le 13$.\n\nTranslated from NOCOW.\n\nUSACO Training Section 1.5"}}]}