Woburn Challenge 2001
How James Bond eluded CBS security in their own headquarters has long been a mystery – to avoid publicizing the secret phone number he used, the details were classified, but have now been cleared for public viewing. Below are excerpts from his report.
"With minimal effort, I was in CBS headquarters, having acquired my
information. However, I was on the top floor and needed to escape from
the building. I quickly made a collect call to London (just by dialing
Having already patched into CBS communication channels, I knew that security had been notified that a meeting was urgently necessary. The chief of security had determined that the elevators were "wonky" and was trying to determine what floor to meet on so that the meeting could be held at the earliest possible time. I knew where everyone in the building was located and P had told me the "schedules" that the elevators follow, so I was able to figure out the shortest amount of time before a meeting could have been held, and on which floor this meeting could take place. It's a good thing the building had no stairs. Now I knew how much time I had to escape and which floor to avoid."
Input Specification
The first line contains
The first line of each test case contains the positive integers
Assume the following:
- All elevators move at the speed of
floor/minute - Every elevator starts with its doors open on the first floor listed
in its schedule at
- A person can get in/out of an elevator instantaneously
Output Specification
For each test case, output a line containing Impossible
.
Sample Input
2
5 3 3
1 3 5
2 1 2
3 5 2 3
2 3 4
4 2 3
1 3 4
2 1 2
2 3 4
Sample Output
4 3
Impossible
Comments