The Minotaur is a half-bull half-man creature living in the Cretan Labyrinth. He terrorizes the whole Crete, especially the city of Minos. Every year seven young boys and girls are sent to the Labyrinth to please the Minotaur. After each sacrifice, the Minotaur sleeps for a while.
Theseus, brave Greek hero half-god half-man, just came to Minos. The people of Minos ask him to kill the Minotaur. Unfortunately, the Minotaur is not an easy target to kill. Theseus doubts his ability to kill even sleeping Minotaur. So he decided to block the Minotaur inside his own Labyrinth.
The Labyrinth has a rectangular shape divided into square cells of equal size. Each cell is either empty or blocked. Blocked cells are impassable even for the Minotaur. The entrance to the Labyrinth is located in one corner of the Labyrinth, while the Minotaur's lair is located in the opposite corner.
Theseus has only one chance to block the Minotaur – while he is asleep after sacrifice, quickly build a square obstacle that blocks some of the Labyrinth's cells. The cells that the obstacle is built on must be empty. The Minotaur is blocked if there is no way from his lair to the entrance of the Labyrinth. Certainly, the obstacle cannot block the Minotaur's lair cell (you cannot build something on top of the Minotaur, even on a sleeping one), as well as the entrance cell (Theseus must not block the Labyrinth completely).
You have to calculate the minimum possible size of the square obstacle that is able to block the Minotaur.
Input
The first line of the input file contains a pair of positive integer numbers
The following .
) and blocked cells – by number signs (#
).
The entrance is located in the upper-left corner (cell
Output
Output three integer numbers Impossible
.
Sample Input 1
11 6
......#####
.#.#...#..#
.#.#.......
.......###.
#####.###..
#####......
Sample Output 1
2 6 3
Sample Input 2
3 3
...
.#.
...
Sample Output 2
Impossible
Comments