Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 2651
The Death Corrider

Time Limit: 10 Seconds      Memory Limit: 32768 KB      Special Judge

An archaeologist want to enter the King's Tomb of a pyramid. But there is a very very long corridor known as the Death Corridor which connects the entrance of the pyramid and the King's Tomb. In order to successfully enter the King's Tomb and avoid death, the archaeologist has got an ancient map about this corridor.

First, on this map, the corridor is marked with many numbers indicating the position in the corridor. At the middle of the corridor, namely, the position with Index 0, there is a detector. Anyone who comes at the middle of the corridor or passes it will activate the protection system of the corridor. When the protection system is activated, some poisonous arrows will come out from the wall of the corridor and kill the intruder.

But the arrows do not come out all the time and altogether, they will follow such rules:
1. If at time T the intruder is at position P, then at time T+A, at all the positions to the right of position P(and including P) arrows will come out(We define the direction to the King's Tomb the right direction).
2. If at time T the intruder is at position P, then at time T+B, at all the positions to the left of position P(and including P) arrows will come out(We define the dirction to the entrance of the pyramid the left direction).
3. Suppose the time when the intruder arrives at the middle of the corrider and activates the protection system is 0, then after N units time(i.e. from time N+1 on) the system will automatically deactivate(the arrows won't come out any more) because the ancient designer of the pyramid thought the intruder is sure to die after N units time.

Will the archaeologist successfully pass the Death Corridor? He turns to you for help. You are asked to find out whether there is a method to avoid death or the archaeologist is destined to die if he insists on going into the pyramid. Suppose the corridor is long enough and the the archaeologist run fast enough(i.e. he can run any number of unit length to the left or right in one unit time but not come out of the corridor).

Input:

There are multiple test cases! Each test case possess a line with three integers N,A,B described above(0<A,B<=N<=20000).

Output:

For each test case, if the archaeologist can successfully pass the Death Corridor, output "Yes" in a line first. Then on the next N lines output how the archaeologist should go from time 0 to time N-1. If the archaeologist should go left S unit length at time T, output on the corresponding line "Left S". Similarly, if the archaeologist should go right S unit length at time T, output on the corresponding line "Right S". Else if the archaeologist should stay at the same position, simply output on the corresponding line "Stay". If there are multiple solutions, output any one. But if the archaeologist cannot pass the corridor, just output one line containing "No".

Sample Input:
2 1 1
3 2 3

Sample Output:
No
Yes
Right 2
Left 3
Right 2



Author: ZHOU Yuan
Source: ZOJ Monthly, February 2006
Submit    Status