program prob58
    implicit none
    integer :: r
    read(*,*) r
    if(r < 1200) then
        write(*,*) "ABC"
    else if(r < 2800) then
        write(*,*) "ARC"
    else
        write(*,*) "AGC"
    end if
    stop
contains
end program prob58