A programming competition site AtCode regularly holds programming contests.
The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.
The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.
The contest after the ARC is called AGC, which is rated for all contestants.
Takahashi's rating on AtCode is R. What is the next contest rated for him?

-----Constraints-----
 - 0 ≤ R ≤ 4208
 - R is an integer.

-----Input-----
Input is given from Standard Input in the following format:
R

-----Output-----
Print the name of the next contest rated for Takahashi (ABC, ARC or AGC).

-----Sample Input-----
1199

-----Sample Output-----
ABC

1199 is less than 1200, so ABC will be rated.

Difficulty: EASY

Solutions:
s = int(input())
print('ABC' if s < 1200 else 'ARC' if s < 2800 else 'AGC')


n = int(input())
print('AGC' if n > 2799 else 'ARC' if n > 1199 else 'ABC')


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


print('A' + 'BRG'[int(input()) // 100 + 4 >> 4] + 'C')


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


R = int(input())
print(['ABC', 'ARC', 'AGC'][0 if R < 1200 else 1 if R < 2800 else 2])


R = int(input())
if R > 2799:
	print('AGC')
elif R > 1199:
	print('ARC')
else:
	print('ABC')


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


r = int(input())
print(['AGC', 'ARC', 'ABC'][sum(map(lambda x: r < x, [1200, 2800]))])


n = int(input())
print('ABC' if n < 1200 else 'ARC' if n < 2800 else 'AGC')


a = int(input())
print('AGC' if a > 2799 else 'ARC' if a > 1199 else 'ABC')


n = int(input())
if n < 1200:
	print('ABC')
elif 1199 < n < 2800:
	print('ARC')
else:
	print('AGC')


rate = int(input())
if rate < 1200:
	print('ABC')
elif rate >= 2800:
	print('AGC')
else:
	print('ARC')


r = int(input())
print('A' + ['G', 'R', 'B'][(r < 1200) + (r < 2800)] + 'C')


a = int(input())
print(['ABC', 'ARC', 'AGC'][(a >= 1200) + (a >= 2800)])


x = int(input())
print('ABC' if x < 1200 else 'ARC' if x < 2800 else 'AGC')


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


print(['ABC', 'ARC', 'AGC'][(int(input()) + 400) // 1600])


R = int(input())
print(['ABC', 'ARC', 'AGC'][(1200 <= R < 2800) - (2800 <= R)])


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


print('A' + 'BRG'[(int(input()) + 400) // 1600] + 'C')


r = int(input())
ans = 'ABC' if r < 1200 else 'ARC' if r < 2800 else 'AGC'
print(ans)


print('A' + ['B', 'R', 'G'][(int(input()) + 400) // 1600] + 'C')


R = int(input())
r = 'AGC'
if R < 2800:
	r = 'ARC'
if R < 1200:
	r = 'ABC'
print(r)


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


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


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


print(['ABC', 'ARC', 'AGC'][int(input()) // 100 + 4 >> 4])


i = int(input())
print('ABC' if i < 1200 else 'ARC' if 1200 <= i < 2800 else 'AGC')


R = int(input())
ans = 'AGC'
if R < 2800:
	ans = 'ARC'
if R < 1200:
	ans = 'ABC'
print(ans)


r = int(input())
print(['ARC' * (r - 1199 > 0) or 'ABC', 'AGC'][r - 2799 > 0])


n = int(input())
if n < 1200:
	print('ABC')
if n >= 1200 and n < 2800:
	print('ARC')
if n >= 2800:
	print('AGC')


import math
r = int(input())
print('ABC' if r < 1200 else 'ARC' if r < 2800 else 'AGC')


x = int(input())
if x <= 1199:
	print('ABC')
elif x <= 2799:
	print('ARC')
else:
	print('AGC')


r = int(input())
s = 'G'
if r < 1200:
	s = 'B'
elif r < 2800:
	s = 'R'
print('A' + s + 'C')


r = int(input())
print('ABC' * (r < 1200) + 'ARC' * (1200 <= r < 2800) + 'AGC' * (r >= 2800))


print(['ABC', 'ARC', 'AGC'][int(input()) // 50 + 8 >> 5])


R = int(input().strip())
print(['ABC', 'ARC', 'AGC'][len([1 for th in [1200, 2800] if R >= th])])


R = int(input())
if R < 1200:
	S = 'B'
elif R < 2800:
	S = 'R'
else:
	S = 'G'
print('A' + S + 'C')


A = int(input())
result = 'ABC' if A < 1200 else 'AGC' if A >= 2800 else 'ARC'
print(result)


R = int(input())
print('A' + 'RGB'[(R >= 2800) + 2 * (R < 1200)] + 'C')


r = int(input())
print([['ABC', 'ARC'][r > 1199], 'AGC'][r > 2799])


S = int(input())
print('ABC' if S < 1200 else 'ARC' if S < 2800 else 'AGC')


n = int(input())
l = ['AGC', 'ARC', 'ABC']
print(l[int(n < 1200) + int(n < 2800)])


N = int(input().strip())
if N < 1200:
	s = 'ABC'
elif N < 2800:
	s = 'ARC'
else:
	s = 'AGC'
print(s)


a = int(input())
s = ''
if a <= 1199:
	s = 'ABC'
elif a <= 2799:
	s = 'ARC'
else:
	s = 'AGC'
print(s)


i = int(input())
print('A%sC' % ('B' if i < 1200 else 'R' if i < 2800 else 'G'))


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


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '1199'
		output = 'ABC'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '1200'
		output = 'ARC'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '4208'
		output = 'AGC'
		self.assertIO(input, output)

def resolve():
	R = int(input())
	if R < 1200:
		print('ABC')
	elif R < 2800:
		print('ARC')
	else:
		print('AGC')

def __starting_point():
	resolve()
__starting_point()


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	R = I()
	if R < 1200:
		print('ABC')
	elif 1200 <= R < 2800:
		print('ARC')
	else:
		print('AGC')

def __starting_point():
	resolve()
__starting_point()


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


r = int(input())
if r <= 1199:
	print('ABC')
elif 1200 <= r <= 2799:
	print('ARC')
else:
	print('AGC')


def main():
	n = int(input())
	if n < 1200:
		print('ABC')
	elif 1200 <= n < 2800:
		print('ARC')
	else:
		print('AGC')
main()


r = int(input())
if r < 1200:
	print('ABC')
if r >= 1200 and r < 2800:
	print('ARC')
if r >= 2800:
	print('AGC')


print('A' + 'BRG'[int(input()) // 50 + 8 >> 5] + 'C')


r = int(input())
print('AGC' if r > 2799 else 'ARC' if r > 1199 else 'ABC')


a = int(input())
print('A' + 'BRG'[(a > 1199) + (a > 2799)] + 'C')


C = ['ABC', 'ARC', 'AGC']
A = int(input())
print(C[(A > 1199) + (A > 2799)])


r = int(input())
print(r // 2800 * 'AGC' or 'AARBCC'[r < 1200::2])


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


rating = int(input())
print('ABC' if rating < 1200 else 'ARC' if rating < 2800 else 'AGC')


A = int(input())
if A > 2799:
	print('AGC')
elif 2800 > A > 1199:
	print('ARC')
else:
	print('ABC')


R = int(input())
txt = 'AGC'
if R < 1200:
	txt = 'ABC'
elif R < 2800:
	txt = 'ARC'
print(txt)


R = int(input())
print('A' + ['GR'[R < 2800], 'B'][R < 1200] + 'C')


n = int(input())
print('A' + ('B' if n < 1200 else 'G' if n > 2799 else 'R') + 'C')


r = int(input())
n = 0 if r < 1200 else 1 if r < 2800 else 2
print(['ABC', 'ARC', 'AGC'][n])


print('A%sC' % 'BRG'[int(input()) // 50 + 8 >> 5])


r = int(input())
if r < 1200:
	print('ABC')
else:
	print('AARGCC'[r > 2799::2])


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


r = int(input())
a = 'G'
if r < 1200:
	a = 'B'
elif r < 2800:
	a = 'R'
print('A{}C'.format(a))


a = int(input())
print('A' + chr(66 + (a > 1199) * 16 - (a > 2799) * 11) + 'C')


K = int(input())
print('ABC' * (K < 1200) or 'ARC' * (K < 2800) or 'AGC')