R = int(eval(input()))

if R >= 2800:

  print('AGC')

elif R >= 1200:

  print('ARC')

else:

  print('ABC')
import bisect,collections,copy,heapq,itertools,math,string

import sys

def S(): return sys.stdin.readline().rstrip()

def M(): return list(map(int,sys.stdin.readline().rstrip().split()))

def I(): return int(sys.stdin.readline().rstrip())

def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def LS(): return list(sys.stdin.readline().rstrip().split())

R = I()

if R < 1200:

    print('ABC')

elif R < 2800:

    print('ARC')

else:

    print('AGC')
R = int(eval(input()))
if R >= 2800:
    print("AGC")
elif R >= 1200:
    print("ARC")
else:
    print("ABC")

import bisect, collections, copy, heapq, itertools, math, string
import sys


def S():
    return sys.stdin.readline().rstrip()


def M():
    return list(map(int, sys.stdin.readline().rstrip().split()))


def I():
    return int(sys.stdin.readline().rstrip())


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


def LS():
    return list(sys.stdin.readline().rstrip().split())


R = I()
if R < 1200:
    print("ABC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")

-R = int(eval(input())) -if R >= 2800: -    print("AGC") -elif R >= 1200: +import bisect, collections, copy, heapq, itertools, math, string +import sys + + +def S(): +    return sys.stdin.readline().rstrip() + + +def M(): +    return list(map(int, sys.stdin.readline().rstrip().split())) + + +def I(): +    return int(sys.stdin.readline().rstrip()) + + +def LI(): +    return list(map(int, sys.stdin.readline().rstrip().split())) + + +def LS(): +    return list(sys.stdin.readline().rstrip().split()) + + +R = I() +if R < 1200: +    print("ABC") +elif R < 2800: -    print("ABC") +    print("AGC")