Lines (2)#530

Lines (2)

1 second
64 megabytes
Medium (≈1350)

In the table of N rows and N columns, some cells are occupied by beads, others are free. Selected ball, you want to move, and wherever it moved. Selected ball at each step moves to the next horizontally or vertically free cell. Required to determine whether it is possible to move the ball from the initial cells in a given, and if possible, find a way out of the fewest steps.

Input

The first line contains the number N (2 ≤ N ≤ 250), the following N lines - on N symbols. The symbol denotes the point of free cells, the Latin capital O - Ball, @ - initial position the ball, which should move the Latin title X - end position of the ball.

Output

The first line of output Y, if the motion is possible, or N, if not. If further movement is possible should abstain N lines of N characters - as well as the input, but X, as well as all points along the path are replaced with positives.

Examples

Example 1

Loading
Loading