#K37202. Alternating Pattern Grid

    ID: 25924 Type: Default 1000ms 256MiB

Alternating Pattern Grid

Alternating Pattern Grid

You are given an integer \(n\) that represents the size of a square grid. Your task is to fill the grid with two characters: A and B in an alternating pattern. The cell at the top-left (first row, first column) should start with A. Adjacent cells (horizontally and vertically) must have alternating characters.

If it is possible to create such a pattern, the first line of output should be YES, followed by \(n\) lines depicting the grid with each cell separated by a space. If \(n\) is odd, output only NO because it is not possible to form a valid alternating pattern on an odd-sized grid.

Note: The alternating pattern is defined such that for a cell at position \( (i, j) \), if \( (i+j) \) is even then it contains A and if odd it contains B.

inputFormat

The input is given from standard input (stdin) and consists of a single integer \(n\), representing the size of the grid.

outputFormat

If \(n\) is even, output YES on the first line. Then output \(n\) lines, each containing \(n\) characters (either A or B) separated by a single space that form an alternating pattern. If \(n\) is odd, output NO only.

## sample
2
YES

A B B A

</p>