program main
     implicit none
     integer a
     read(*,*)a
     if(a<1200)then
          write(*,*)"ABC"
     elseif(a<2800)then
          write(*,*)"ARC"
     else
          write(*,*)"AGC"
     endif
end program main
