시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB92664575.000%

문제

After quite a lot of effort Bytie has finally managed to put n rooks on a board of size n × n so that no two of them attack each other. A quick reminder: a rook attacks all the fields of the board that are located in the same row or in the same column as it is1.

Unfortunately, the boy has now accidentally hit the board. As a result, several rooks have fallen down from it. Could you help Bytie put these rooks back on the board? The boy would like to leave the rooks that are still on the board intact.

1. See also http://en.wikipedia.org/wiki/Rook_(chess)

입력

The first line of the standard input contains one integer n (2 ≤ n ≤ 1 000) that represents the size of the board. A description of the configuration of the rooks follows: the following n lines contain n characters each. The character '.' represents an empty field whereas the letter 'W' represents a field occupied by a rook.

You can assume that there are w rooks on the board with 1 ≤ wn - 1 and that no pair of rooks on the board attacks each other.

출력

Your program should write to the standard output n lines containing n characters '.' or 'W' each: the final configuration of rooks on the board. The description should contain exactly n occurrences of the letter 'W' with w rooks placed in the same positions as in the initial board. No two rooks may attack each other. If there are multiple ways of placing n - w rooks on the initial board, your program should output any one of them.

예제 입력 1

8
........
.....W..
..W.....
.......W
W.......
........
.W......
........

예제 출력 1

...W....
.....W..
..W.....
.......W
W.......
....W...
.W......
......W.