SP11909 PUCMM223 - C You and Me

Description

You and Me is a board game between two players, the board is MxN, with 1

Input Format

For each test case the first line contains two separated integers, M and N, rows and columns of the board. then M strings of N characters follow. Each character could be '.', '#', 'a', 'b'. Just one 'a' and one 'b' exists. The last case is followed by 0 0.

Output Format

Output the minimum number of moves required to achieve the goal. Output IMPOSSIBLE if it is not possible.