program ABC104A
    implicit none
    integer(8)::R

    read(5,*)R

    if(R<1200)then
        print'(A)',"ABC"
    else if(R<2800)then
        print'(A)',"ARC"
    else
        print'(A)',"AGC"
    end if
    
end program ABC104A