public static void main ( String [ ] args ) throws Throwable {
  Scanner in = SAMPLE ? new Scanner ( System . in ) : new Scanner ( new File ( PATH + PROBLEM + "-" + INPUT + "-" + ID + ".in" ) ) ;
  PrintStream out = SAMPLE ? System . out : new PrintStream ( PATH + PROBLEM + "-" + INPUT + "-" + ID + ".out" ) ;
  int test = in . nextInt ( ) ;
  for ( int t = 1 ;
  t <= test ;
  t ++ ) {
    out . print ( "Case #" + t + ": " ) ;
    int omino = in . nextInt ( ) ;
    int row = in . nextInt ( ) ;
    int col = in . nextInt ( ) ;
    boolean firstPlayerWin ;
    if ( row * col % omino != 0 ) {
      firstPlayerWin = true ;
    }
    else {
      int minSide = Math . min ( row , col ) ;
      int maxSide = Math . max ( row , col ) ;
      if ( omino == 1 ) {
        firstPlayerWin = false ;
      }
      else if ( omino == 2 ) {
        firstPlayerWin = false ;
      }
      else if ( omino == 3 ) {
        if ( minSide == 1 ) {
          firstPlayerWin = true ;
        }
        else {
          firstPlayerWin = false ;
        }
      }
      else if ( omino == 4 ) {
        if ( minSide <= 2 ) {
          firstPlayerWin = true ;
        }
        else {
          firstPlayerWin = false ;
        }
      }
      else if ( omino == 5 ) {
        if ( minSide <= 2 ) {
          firstPlayerWin = true ;
        }
        else if ( minSide == 3 ) {
          if ( maxSide == 5 ) {
            firstPlayerWin = true ;
          }
          else {
            firstPlayerWin = false ;
          }
        }
        else {
          firstPlayerWin = false ;
        }
      }
      else if ( omino == 6 ) {
        if ( minSide <= 2 ) {
          firstPlayerWin = true ;
        }
        else if ( minSide == 3 ) {
          firstPlayerWin = true ;
        }
        else {
          firstPlayerWin = false ;
        }
      }
      else {
        firstPlayerWin = true ;
      }
    }
    out . println ( firstPlayerWin ? "RICHARD" : "GABRIEL" ) ;
  }
  out . close ( ) ;
  in . close ( ) ;
  System . out . println ( "finish!" ) ;
}

public static void main ( String [ ] args ) throws Throwable { Scanner in = SAMPLE ? new Scanner ( System . in ) : new Scanner ( new File ( PATH + PROBLEM + " - " + INPUT + " - " + ID + " . in " ) ) ; PrintStream out = SAMPLE ? System . out : new PrintStream ( PATH + PROBLEM + " - " + INPUT + " - " + ID + " . out " ) ; int test = in . nextInt ( ) ; for ( int t = 1 ; t <= test ; t ++ ) { out . print ( " Case ▁ # " + t + " : ▁ " ) ; int omino = in . nextInt ( ) ; int row = in . nextInt ( ) ; int col = in . nextInt ( ) ; boolean firstPlayerWin ; if ( row * col % omino != 0 ) { firstPlayerWin = true ; } else { int minSide = Math . min ( row , col ) ; int maxSide = Math . max ( row , col ) ; if ( omino == 1 ) { firstPlayerWin = false ; } else if ( omino == 2 ) { firstPlayerWin = false ; } else if ( omino == 3 ) { if ( minSide == 1 ) { firstPlayerWin = true ; } else { firstPlayerWin = false ; } } else if ( omino == 4 ) { if ( minSide <= 2 ) { firstPlayerWin = true ; } else { firstPlayerWin = false ; } } else if ( omino == 5 ) { if ( minSide <= 2 ) { firstPlayerWin = true ; } else if ( minSide == 3 ) { if ( maxSide == 5 ) { firstPlayerWin = true ; } else { firstPlayerWin = false ; } } else { firstPlayerWin = false ; } } else if ( omino == 6 ) { if ( minSide <= 2 ) { firstPlayerWin = true ; } else if ( minSide == 3 ) { firstPlayerWin = true ; } else { firstPlayerWin = false ; } } else { firstPlayerWin = true ; } } out . println ( firstPlayerWin ? " RICHARD " : " GABRIEL " ) ; } out . close ( ) ; in . close ( ) ; System . out . println ( " finish ! " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (identifier) consequence: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))) alternative: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier)) right: (string_literal))))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (identifier) consequence: (field_access object: (identifier) field: (identifier)) alternative: (object_creation_expression type: (type_identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (string_literal)) right: (identifier)) right: (string_literal)) right: (identifier)) right: (string_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (identifier)) right: (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (false)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false)))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (false))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (true)))))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (ternary_expression condition: (identifier) consequence: (string_literal) alternative: (string_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))