r = int(eval(input()))

ans = 'ARC'

if r < 1200: ans = 'ABC'

elif 2800 <= r: ans = 'AGC'

print(ans)

r = int(eval(input()))

if r < 1200: print('ABC')

elif 2800 <= r: print('AGC')

else: print('ARC')

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

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

-ans = "ARC" -    ans = "ABC" +    print("ABC") -    ans = "AGC" -print(ans) +    print("AGC") +else: +    print("ARC")