402913: GYM100947 A Traffic Lights

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Traffic Lightstime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

Tamer is traveling with his brother on a long highway. He sees a traffic light at a distance. He calculated that it will take him x seconds until he arrives at the traffic light, he also knows that the green light lasts for g seconds, the yellow light lasts for y seconds and the red light lasts for r seconds. Now he is wondering in what color will the light be when he arrives there?

You know he is now busy driving, so he asks you to tell him the answer! you know that the light has just turned green at the moment of his question, and that the sequence of the lights is: GREEN, YELLOW, RED and then GREEN and so on.

Input

The first line of input contains one integer T - the number of test cases.

Each test case contains four integers x, g, y, r as described in the statement.

1 ≤ x, g, y, r ≤ 109

Output

For each test case output a single word, "RED" or "YELLOW" or "GREEN" without the quotes.

ExamplesInput
3
5 5 2 8
7 5 2 8
16 5 2 8
Output
YELLOW
RED
GREEN
Note

In the samples the light changes as follows:

Light: g, g, g, g, g, y, y, r, r, r, r, r , r , r , r , g , g , g , g ...

Time : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18...

加入题单

算法标签: