r=int(eval(input()))

data=(1200,2800)

name=('ABC', 'ARC', 'AGC')



z=[name[0] if r < 1200 else name[1] if data[0] <= r < data[1] else name[2] if data[1] <= r else i for i in range(1)]

print((z[0]))
r=int(eval(input()))



if r<1200:

  print('ABC')

elif r<2800:

  print('ARC')

else:

  print('AGC')
r = int(eval(input()))
data = (1200, 2800)
name = ("ABC", "ARC", "AGC")
z = [
    name[0]
    if r < 1200
    else name[1]
    if data[0] <= r < data[1]
    else name[2]
    if data[1] <= r
    else i
    for i in range(1)
]
print((z[0]))

r = int(eval(input()))
if r < 1200:
    print("ABC")
elif r < 2800:
    print("ARC")
else:
    print("AGC")

-data = (1200, 2800) -name = ("ABC", "ARC", "AGC") -z = [ -    name[0] -    if r < 1200 -    else name[1] -    if data[0] <= r < data[1] -    else name[2] -    if data[1] <= r -    else i -    for i in range(1) -] -print((z[0])) +if r < 1200: +    print("ABC") +elif r < 2800: +    print("ARC") +else: +    print("AGC")