Write a program to print all the ways to place queens on an chessboard so that no queen threatens another queen.
Input consists of a natural number .
Print all the ways to put
queens on an
chessboard so that no queen threatens another queen. The queens must be
marked with a ‘Q’, and the empty positions with a dot.
Print an empty line after each board.
You can print the solutions to this exercise in any order.
Input
4
Output
.Q.. ...Q Q... ..Q. ..Q. Q... ...Q .Q..
Input
3
Output