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: introductory

Starter code:

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

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


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

n = int(input())

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

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


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

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

R = int(input())

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

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

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

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

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()

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

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

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

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

R = int(input())

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

a = int(input())

if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else:
    print("AGC")

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

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

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

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


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

r=int(input())

if r<1200:
    ans="ABC"

elif r<2800:
    ans="ARC"
    
else:
    ans="AGC"
    
print(ans)


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

num1 = int(input())

while(num1 >= 0):
  if num1 < 1200:
    print(f"ABC")
  elif num1 >= 1200 and num1 < 2800:
    print(f"ARC")
  elif num1 >= 2800 and num1 <= 4208:
    print(f"AGC")
  break


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

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

a = int(input())

if a < 1200:
    print("ABC")
elif 1200 <= a < 2800:
    print("ARC")
elif 2800 <= a:
    print("AGC")

R = int(input())

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

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

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

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


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


R = int(input())

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

R = int(input())

if R >= 2800:
    print('AGC')
elif R >= 1200:
    print('ARC')
else:
    print('ABC')

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

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

R = int(input())

if R < 1200:
  print('ABC')
elif R < 2800:
  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')
elif r<2800:
  print("ARC")
else:
  print("AGC")

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

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

r = int(input())

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


r = int(input())

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


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

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

R = int(input())

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


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

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

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

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

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

rating = int(input())

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


R = int(input())

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

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

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

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


#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
r = I()
if r < 1200:
    print('ABC')
elif r < 2800:
    print('ARC')
else:
    print('AGC')


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

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

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

n=int(input())
if n <1200:
  print("ABC")
elif 1200<=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())
if r < 1200:
  print("ABC")
elif r < 2800:
  print("ARC")
else:
  print("AGC")

# -*- coding: utf-8 -*-
# 標準入力を取得
R = int(input())

# 求解処理
ans = str()
if R < 1200:
    ans = "ABC"
elif R < 2800:
    ans = "ARC"
else:
    ans = "AGC"

# 結果出力
print(ans)


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

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


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

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


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

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

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

R=int(input())

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


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

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

r = int(input())

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

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

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

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

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

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

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


R = int(input())

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


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

#
# abc104 a
#
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():
    # unittest.main()
    resolve()

__starting_point()

r = int(input())

if r < 1200:
    print("ABC")
elif r <2800:
    print("ARC")
else:
    print("AGC") 


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

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


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

R = int(input())

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

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

R = int(input())

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

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

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

R = int(input())

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

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


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

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

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