N=int(eval(input()))

if N<1200:

    print("ABC")

elif N<2800:

    print("ARC")

else:

    print("AGC")
N=int(eval(input()))

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

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

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