r = int(eval(input()))

if r < 1200:

    print('ABC')

elif r < 2800:

    print('ARC')

else:

    print('AGC')
r = int(eval(input()))

if r < 1200:

    print('ABC')

elif 1200 <= r < 2800:

    print('ARC')

else:

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

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

-elif r < 2800: +elif 1200 <= r < 2800: