rating = int(eval(input()))



if rating < 1200:

    print('ABC')

elif 1200 <= rating < 2800:

    print('ARC')

elif rating >= 2800:

    print('AGC')

r = int(eval(input()))



if r < 1200:

    print('ABC')

elif r < 2800:

    print('ARC')

else:

    print('AGC')

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

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

-rating = int(eval(input())) -if rating < 1200: +r = int(eval(input())) +if r < 1200: -elif 1200 <= rating < 2800: +elif r < 2800: -elif rating >= 2800: +else: