eolymp
bolt
Try our new interface for solving problems
Problems

N Queens - placement

N Queens - placement

Time limit 1 second
Memory limit 128 MiB

Given a chess board having n * n cells. You need to place n queens on the board in such a way that no queen attacks any other queen.

Input data

The size of the chess board n (1n10).

Output data

If it is possible to place all the n queens in such a way that no queen attacks another queen, then print n lines having n integers. The integer in i-th line and j-th column will denote the cell (i, j) of the board and should be 1 if a queen is placed at (i, j) and 0 otherwise. If there are more than way of placing queens print any of them. If it is not possible to place all n queens in the desired way, then print "Not possible" (without quotes).

Examples

Input example #1
4
Output example #1
0 1 0 0 
0 0 0 1 
1 0 0 0 
0 0 1 0