5783: n皇后问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:38 Solved:23

Description

在一个国际棋棋盘上,放置n个皇后(n<=10),使她们相互之间不能进攻。求出所有布局。

Input

一个自然数n,表示n个皇后。

Output

每行输出一种方案,每种方案顺序输出皇后所在的列号,每个数之间用空格隔开。

Sample Input Copy

4

Sample Output Copy

2 4 1 3
3 1 4 2