R = int(eval(input()))



if R < 1200:

    print('ABC')

elif 1200 <= R < 2800:

    print('ARC')

else:

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

print(('ABC' if R < 1200 else 'ARC' if 1200 <= R < 2800 else 'AGC'))

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

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

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