program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: r

    read*, r
    if (r < 1200) then
        print'(a)', 'ABC'
    else if (r < 2800) then
        print'(a)', 'ARC'
    else
        print'(a)', 'AGC'
    end if
end program main