#K93767. Knights Threat Assessment

    ID: 38493 Type: Default 1000ms 256MiB

Knights Threat Assessment

Knights Threat Assessment

You are given an \( N \times N \) chessboard. Some cells of the board are occupied by knights, which are denoted by the character 'K', and empty cells are denoted by the character '.'. Recall that a knight in chess moves in an L-shape: two cells in one direction and one cell perpendicular to that direction. In other words, a knight can move to any of the cells (i \( \pm \)2, j \( \pm \)1) or (i \( \pm \)1, j \( \pm \)2) relative to its current position.

Your task is to determine whether any two knights on the board can attack each other. Two knights are considered to be threatening each other if one knight can move to the cell occupied by the other in a single legal knight move.

Note: The moves of a knight are given by the set of offsets \( \{ (2,1), (2,-1), (-2,1), (-2,-1), (1,2), (1,-2), (-1,2), (-1,-2) \} \).

inputFormat

The first line contains an integer \( N \) \( (1 \leq N \leq 100) \), representing the size of the chessboard. This is followed by \( N \) lines, each containing a string of length \( N \) composed of characters 'K' (denoting a knight) and '.' (denoting an empty cell).

outputFormat

Output a single line containing "YES" if there exists at least one pair of knights that threaten each other, and "NO" otherwise.

## sample
5
.....
.....
..K..
.....
.....
NO