Uses Math;
var test, tests, a, c, b, r, g, max, ans, cur: integer;
begin
  assign(input, 'bet.in');
  assign(output, 'bet.out');
  reset(input);
  rewrite(output);
  readln(tests);
  for test := 1 to tests do begin
    readln(a, c);
    readln(r, g, b);
    ans := 1;
    max := a * (sqr(r + 1) + sqr(g) + sqr(b)) + c * min(min(r + 1, g), b);
    cur := a * (sqr(r) + sqr(g + 1) + sqr(b)) + c * min(min(r, g + 1), b); 
    if (cur > max) then begin
    	max := cur;
    	ans := 2;
    end;
    cur := a * (sqr(r) + sqr(g) + sqr(b + 1)) + c * min(min(r, g), b + 1); 
    if (cur > max) then begin
    	max := cur;
    	ans := 3;
    end;
    if (ans = 1) then writeln('RED');
    if (ans = 2) then writeln('GREEN');
    if (ans = 3) then writeln('BLUE');
  end;
end.