Emotional Bishop

A bishop is a piece in the board game of chess. It is only allowed to move diagonally. But it has no restriction on the distance for each move. We can denote a position of a bishop by (r,c) if it is in r-th row and c-th column. So formally we can say that, A bishop can go from (r1, c1) to (r2, c2) if and only if |r1 − r2| = |c1 − c2|, i.e. absolute difference of rows and absolute difference of columns are equal. And also a bishop cannot move outside the board. See the following pictures to make things clear, where the by ‘X’ sign the valid moves of the bishop are shown. There was a bishop which is very emotional that it didn’t like fight- ing. So it didn’t involve itself into any chess game. As no other bishop is like it, it has to live alone in a board. So it created its own boards. It doesn’t want to restrict itself in a 8 × 8 chessboard. So it created many two dimensional boards of different sizes. It had a board of size 100×100 (i.e. 100 rows and 100 columns), another board of size 1000 × 2000 (i.e. 1000 rows and 2000 columns, you see it even didn’t restrict itself on row-column equality). Everything was going perfect for that emotional bishop until the day when it discovered that it needs to move to a new cell. Since the bishop is too emotional he wants to go to the destination in fewest moves. In this problem, you have to calculate the minimum number of moves required for the emotional bishop to reach the destination. If the destination is impossible to reach, you have to say ‘impossible’. Input The input starts with an integer T (1 ≤ T ≤ 10000), the number of test cases. Each of the next T lines will describe one test case by six integers R (1 ≤ R ≤ 1000000000), C (1 ≤ C ≤ 1000000000), SR (1 ≤ SR ≤ R), SC (1 ≤ SC ≤ C), DR (1 ≤ DR ≤ R) and DC (1 ≤ DC ≤ C). Here R is the number of rows in the board, C is the number of columns in the board, (SR,SC) is the initial square of the bishop, (DR,DC) is the target location of the bishop. Initial location, target location are distinct. Output For each test case output a single line in the format ‘Case K: N’, where K is the case number and N is the minimum number of moves to reach the destination if it is possible to reach the destination and ‘impossible’ (quotes for clarity) otherwise. See sample output for exact format. Sample Input 2 10 10 2 2 4 4 10 10 2 2 4 5 Sample Output Case 1: 1 Case 2: impossible Bishop can move to any square diagonally inside the board