The Revolution of the Ants

After living in Bill Hill for 100 million years, the ants will face the most serious crisis. One soldier ant, White Young Hunter, has got the news that human beings will develop this area. He must let all the communication ants (com-ants) know this message so that the message can be broadcast to the whole empire, and these ants can start a revolution to survive the distress. There are on Bill Hill many anthills connected by some paths, which have special smell. Each com-ant always moves at the same speed on its circular cruise route, which is composed of several smell paths. When two com-ants meet in a path, they will exchange all of their messages. The time of the exchange can be ignored. At the beginning, all the com-ants are at the first anthill in their routes, and White Young Hunter tells the news to the com-ant numbered 1 (The soldier ant has been tired out after having run from the human world to Bill Hill, and had better have a good rest). Your task is to write a program to figure out whether all the com-ants can get the message. Input The input file consists of several test cases. Each case will begin with three integers n, m and a (0 ≤ n < 100, 0 ≤ m < 100, 0 ≤ a < 100) which indicate the number of the anthills, the number of the paths, and the number of the com-ants. Following n, m and a, there are m lines which describe the paths. Each line includes three positive integers x, y and t, which indicate the two end points of the path and the time for an ant to cruise from one end to the other. Each (x,y) appears no more than once. Following the path description, there are a lines, which describe the cruise routes. Each line includes several integers, which indicate the anthill number on the route, and is ended by a single zero. Any route will not contain more than 100 waypoints. While n, m and a equals zero indicates the end of the file, which should not be processed. Output For each test case, find out whether all the com-ants can get the message. Display, as shown below, the test case number and the solution ‘Revolution can start.’ or ‘Revolution fails.’ if it is impossible to let all com-ants know the message. A blank line should be printed after each test case. Sample Input 332 122 232 312 1230 3210 332 122 232 312 1230 2310 000

2/2 Sample Output Revolution #1 Revolution can start. Revolution #2 Revolution fails.