#K36867. Crowley's Labyrinth Escape

    ID: 25850 Type: Default 1000ms 256MiB

Crowley's Labyrinth Escape

Crowley's Labyrinth Escape

Crowley is trapped in a labyrinth that can be represented as a grid of size $N \times M$. Each cell of the grid is either open (denoted by .) or blocked (denoted by #). Crowley starts at the top-left cell and wants to reach the bottom-right cell. However, he is only allowed to move in two directions: down or right.

Your task is to determine if Crowley can escape the labyrinth, i.e. reach the destination using only the allowed moves. If it is possible, output YES, otherwise output NO.

inputFormat

The first line contains two integers N and M — the number of rows and columns of the grid, respectively. The next N lines each contain M characters separated by spaces, representing the labyrinth. A dot (.) denotes an open cell and a hash (#) denotes a blocked cell.

outputFormat

Output a single line containing YES if Crowley can reach the bottom-right cell from the top-left cell using only moves down and right, or NO otherwise.

## sample
4 4
. . . #
. # . .
. . # .
. . . .
YES