main :: IO ()
main = do
  r <- readLn
  putStrLn $ solve r

solve :: Int -> String
solve r
  | r < 0 = err
  | r < 1200 = "ABC"
  | r < 2800 = "ARC"
  | r <= 4208 = "AGC"
  | r > 4208 = err
 where
  err = error $ "Invalided Rate: " ++ show r