162. Frog

Problem Statement:
Every weekend, our friend Milo visits his parents. In his way, there is a river. Every time Milo crosses the river, he thinks about how he can cross it in a minimal number of jumps! Yes, our friend is a frog! He needs your help to find the best steps.
Many wood circles float in the river in an integer coordinate, the part of the river that has these floating circles is 50m * 50m. Milo starts from the middle of the left side (at point (25, 0)) and want to go to the middle of the other side (at point (25, 50)), noting that Milo can't walk on any river sides. Milo can jump to a limited number of meters.

Input Format:
The input consists of multiple test cases, the first line has an integer (t<100) represents the number of test cases. Each test case starts with a line containing two integers (0<d<=50, 0<n<=50): d is the max distance that Milo can jump, n is the number of floating wood circles. The following n line each contains two integers (0<x, y<50) represent the coordinate of a single circle (circle is represented as points, there is no radius).

Output Format:
For each test case outputs the minimal number of required jumps to cross the river or "Impossible" without quotes in case there is no way to cross the river.

Sample Input:
2 2 3 5 5 10 10 20 20 25 5 15 5 20 15 20 35 35 5 20 20

Sample Output:
Impossible 3

 Added by: feras_kassar Added at: 2014-05-19 20:19:54 UTC Time Limit: 2 seconds Partial score: No Source: Tishreen-CPC 2014