IN = open('bet.in')
OUT = open('bet.out', 'w')

def f(a, c, r, g, b):
    return a * r * r + a * g * g + a * b * b + c * min(r, g, b)
n = int(IN.readline())
s = ""
for i in range(n):
    a, c = map(int, IN.readline().split())
    r, g, b = map(int, IN.readline().split())
    rs = f(a, c, r + 1, g, b)
    gs = f(a, c, r, g + 1, b)
    bs = f(a, c, r, g, b + 1)
    if rs > gs and rs > bs:
        print("RED", file=OUT)
    elif gs > bs:
        print("GREEN", file=OUT)
    else:
        print("BLUE", file=OUT)
