cho.sh
Notes
Loading...

Small Squares

Time limit

2s

Memory limit

512 MB

Problem

Youngsik and Minsik play a coloring game on grid paper. On each turn, a player may color either one empty 1×1 square or one empty 2×2 square. The player who colors the last square wins.

There is one restriction on coloring a 2×2 square. Number the rows from top to bottom as 1, 2, 3, and so on. The upper two cells of a 2×2 square must be in an odd-numbered row. In other words, the top row of the 2×2 square must be row 1, 3, 5, and so on.

The green placement shown above is allowed.

The red placement shown above is not allowed.

Given the cells that are already colored, determine the winner when Youngsik moves first and both players play optimally.

Input

The input contains exactly 3 test cases.

For each test case, the first line contains the height N and width M of the board. Both N and M are positive integers no greater than 10. The next N lines describe the board. Each line is a string of length M; . means an uncolored cell, and # means a cell that is already colored.

Output

For each test case, print one line: Y if Youngsik wins, or M if Minsik wins.