The left-hand rule, which is also known as the wall follower, is a well-known strategy that solves a two- dimensional maze. The strategy can be stated as follows: once you have entered the maze, walk around with keeping your left hand in contact with the wall until you reach the goal. In fact, it is proven that this strategy solves some kind of mazes.

Your task is to write a program that determines whether the given maze is solvable by using the left-hand rule and (if the maze is solvable) the number of steps to reach the exit. Moving to a cell from the entrance or the adjacent (north, south, east or west) cell is counted as a step.

In this problem, the maze is represented by a collection of walls placed on the two-dimensional grid.
We use an ordinary Cartesian coordinate system; the positive *x*-axis points right and the positive *y*-axis
points up. Each wall is represented by a line segment which is parallel to the *x*-axis or the *y*-axis, such
that both ends of each wall are located on integer coordinates. The size of the maze is given by *W* and *H*
that indicate the width and the height of the maze, respectively. A rectangle whose vertices are on (0, 0),
(*W*, 0), (*W*, *H*) and (0, *H*) forms the outside boundary of the maze. The outside of the maze is always
surrounded by walls except for the entrance of the maze. The entrance is represented by a line segment
whose ends are (*x _{E}*,

A few examples of mazes are illustrated in the figure below. They correspond to the datasets in the sample input.

Figure 1: Example Mazes (shaded squares indicate the exits)

The input consists of multiple datasets.

Each dataset is formatted as follows:

W H Nx_{1}y_{1}x_{1}'y_{1}'x_{2}y_{2}x_{2}'y_{2}' ...x_{N}y_{N}x_{N}'y_{N}'x_{E}y_{E}x_{E}'y_{E}'x_{X}y_{X}

*W* and *H* (0 < *W*, *H* ≤ 100) indicate the size of the maze. *N* is the number of walls inside the maze.
The next *N* lines give the positions of the walls, where (*x _{i}*,

The input is terminated by a line with three zeros.

For each dataset, print a line that contains the number of steps required to reach the exit. If the given maze is unsolvable, print gImpossibleh instead of the number of steps.

3 3 3 1 0 1 2 1 2 2 2 2 2 2 1 0 0 1 0 1 1 3 3 4 1 0 1 2 1 2 2 2 2 2 2 1 2 1 1 1 0 0 1 0 1 1 3 3 0 0 0 1 0 1 1 0 0 0

9 Impossible Impossible

Source: ACM-ICPC Japan Alumni Group Summer Camp 2008
, Day 2, Tokyo, Japan, 2008-09-13

http://acm-icpc.aitea.net/

http://acm-icpc.aitea.net/