There has been reports of aliens invading some locations in Bangalore city and we need our X-men to save us.
There are two clever X-men, Wolverine and Cyclops, who decided to pool car from their respective locations to invaded location for commute.
They have to travel the fastest way from current location to destination.
They have to have perfect synchronization (i.e. reach destination at same time) to avoid aliens dominating one of them.
They also decide that if their fastest routes happen to intersect, one of them will share car with other.
Wolverine and Cyclops acquire a time map of Bangalore city. It basically is a map of the time it will take to commute between any two locations L1 and L2. However, Wolverine and Cyclops have not taken algorithms classes and you need to help them as their technical advisor.
Your Mission Objectives
You are going to write a program that reads in the map information, current locations of Wolverine (W) and Cyclops (C) and their final destination (A). You are then going to output answers to the following questions.
Who has to leave first ? [Wolverine or Cyclops, case sensitive]
How long (in minutes) the first X-man should leave before the second ? [positive integer T]
Can Wolverine and Cyclops share a car? [Yes or No , case sensitive]
You can assume there will never be a case where both Cyclops and Wolverine need to leave at same time.
The inputs to your program looks like following On first line, you are given a number N, representing the total number of locations in Bangalore. All locations are simply numbered 1,2,3 ... N.
On second line, you are given four space separated numbers W C A M. W,C and A represents the location of Wolverine, Cyclops and Aliens respectively.
M represents the number of location pairs with known travelling time between the two locations
On next M lines, you are given three space separated numbers L1 L2 TT representing first location, second location and time to travel (in minutes) between L1 and L2
The output of your program should answer the questions above in 1 line as follows Wolverine or Cyclops T Yes or No The values in output are space separated Constraints on the parameters
2 <= N <= 10000
1 <= W,C,A <= N
1 <= M <= 50000000
0 <= TT <= 180
1 7 4 6
1 2 12
2 3 5
3 4 5
7 6 12
6 5 10
5 4 4
Cyclops 4 No
1 2 4 3
1 3 17
2 3 10
3 4 5
Wolverine 7 Yes