#include <cassert>
#include <cstdio>

int A, C;

int res( int r, int g, int b ) {
  int mn = r;
  if (g < mn)
    mn = g;
  if (b < mn)
    mn = b;
  return A * (r * r + g * g + b * b) + C * mn;
}

int main() {
  assert(freopen("bet.in", "r", stdin));
  assert(freopen("bet.out", "w", stdout));

  int t;
  assert(scanf("%d", &t) == 1);
  while (t --> 0) {
    int r, g, b;
    assert(scanf("%d%d", &A, &C) == 2);
    assert(scanf("%d%d%d", &r, &g, &b) == 3);
    int res_r = res(r + 1, g, b);
    int res_g = res(r, g + 1, b);
    int res_b = res(r, g, b + 1);
    if (res_r >= res_g && res_r >= res_b)
      puts("RED");
    else if (res_g >= res_b)
      puts("GREEN");
    else
      puts("BLUE");
  }

  return 0;
}
