public void solve() throws IOException {
    int tests = nextInt();
    for (int t = 0; t < tests; t++) {
      int x = nextInt();
      int r = nextInt();
      int c = nextInt();
      int area = r * c;
      boolean possible = (area % x == 0);
      if (x == 4) {
        possible &= (Math.min(r, c) >= 3);
      }
      if (x == 3) {
        possible &= (Math.min(r, c) >= 2);
      }
      out.format("Case #%d: %s%n", t + 1, (possible) ? "GABRIEL" : "RICHARD");
    }
  }