Rooks

No attempts yetTime limit1sMemory limit128 MB

Problem

After a lot of effort, Bytie has finally managed to place nn rooks on an n×nn \times n board so that no two of them attack each other. As a reminder, a rook attacks every square that lies in the same row or the same column as it.

Unfortunately, Bytie has now accidentally bumped the board and several rooks have fallen off. Leaving every rook that is still on the board exactly where it is, help Bytie put the fallen rooks back so that all nn rooks are on the board again and no two of them attack each other.

Input

The first line contains one integer nn (2n10002 \le n \le 1\,000), the size of the board. Each of the next nn lines contains nn characters describing the current configuration. The character '.' is an empty square, and the character 'W' is a square occupied by a rook.

There are ww rooks on the board with 1wn11 \le w \le n - 1, and no two of them attack each other.

Output

Print nn lines of nn characters each ('.' or 'W') describing the completed board. It must contain exactly nn rooks, keep every initial rook in its original position, and have no two rooks attacking each other.

Because the nwn - w fallen rooks can be placed in more than one way, print the lexicographically smallest such board. Treat the board as the string formed by its output lines read top to bottom, each line left to right, and consider '.' to come before 'W'.