#K54087. Decorative Panel
Decorative Panel
Decorative Panel
You are given an integer \(n\) representing the side length of a square grid (\(3 \leq n \leq 50\)). Your task is to create a decorative panel by generating an \(n \times n\) grid filled with characters 'B' and 'W'. The grid must be constructed such that no row or column contains three consecutive identical tiles.
If it is not possible to create such a grid (i.e. when \(n < 3\)), output IMPOSSIBLE
.
When it is possible, follow a chessboard pattern starting with 'B' in the top-left corner. For example, a valid grid for \(n = 5\) is:
BWBWB WBWBW BWBWB WBWBW BWBWB
inputFormat
The input consists of a single integer \(n\) read from standard input.
outputFormat
If \(n < 3\), output IMPOSSIBLE
(without quotes). Otherwise, output the grid to standard output: each of the \(n\) rows should be printed on a new line.
1
IMPOSSIBLE