Problem:
Score : 100 points

Problem Statement

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 1

1199

Sample Output 1

ABC

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

Sample Input 2

1200

Sample Output 2

ARC

1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.

Sample Input 3

4208

Sample Output 3

AGC

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
  class Program
  {
    static void Main(string[] args)
    {
      ABC104.A();
    }
    class ABC104
    {
      public static void A()
      {
        var R = Read.Int();
        Console.WriteLine(R < 1200 ? "ABC" : R < 2800 ? "ARC" : "AGC");
      }
      public static void B()
      {
        var S = Read.Str();
        if (S[0] != 'A') { Console.WriteLine("WA"); return; }
        if (!S.Substring(2, S.Length - 3).Contains('C')) { Console.WriteLine("WA"); return; }
        var rep = S.Replace("A", "").Replace("C", "");
        if (rep.Length != S.Length - 2) { Console.WriteLine("WA"); return; }
        if (rep != rep.ToLower()) { Console.WriteLine("WA"); return; }
        Console.WriteLine("AC");
      }
      public static void C()
      {
        var D = Read.Int();
        var G = Read.Int();
        var PC = Read.TupleInt(D);
        var dp = new long[D + 1, D * 100 + 1];
        for(int d = 0; d < D; ++d)
        {
          var P = PC[d].Item1;
          var C = PC[d].Item2;
          for (int p = 0; p <= P; ++p)
          {
            var g = (d + 1) * p * 100 + (p == P ? C : 0);
            for(int i = 0; i <= d * 100; ++i)
            {
              dp[d + 1, i + p] = Math.Max(dp[d + 1, i + p], dp[d, i] + g);
            }
          }
        }
        for(int i = 0; i <= D * 100; ++i)
        {
          if (dp[D, i] >= G) { Console.WriteLine(i); return; }
        }
      }
      public static void D()
      {
        var str = Read.Str();
        var N = str.Length;
        var dp = new long[N + 1, 4];
        dp[0, 0] = 1;
        for (int i = 0; i < N; ++i)
        {
          var c = str[i];
          dp[i + 1, 0] = (dp[i, 0] * (c == '?' ? 3 : 1)) % Util.P;
          dp[i + 1, 1] = (dp[i, 1] * (c == '?' ? 3 : 1) + (c == '?' || c == 'A' ? 1 : 0) * dp[i, 0]) % Util.P;
          dp[i + 1, 2] = (dp[i, 2] * (c == '?' ? 3 : 1) + (c == '?' || c == 'B' ? 1 : 0) * dp[i, 1]) % Util.P;
          dp[i + 1, 3] = (dp[i, 3] * (c == '?' ? 3 : 1) + (c == '?' || c == 'C' ? 1 : 0) * dp[i, 2]) % Util.P;
        }
        Console.WriteLine(dp[N, 3]);
      }
    }

    class Util
    {
      public static long[] ASum(long[] array)
      {
        var res = new long[array.Length + 1];
        for (int i = 0; i < array.Length; ++i)
        {
          res[i + 1] = res[i] + array[i];
        }
        return res;
      }
      public static long[,] ASum(long[,] matrix)
      {
        var N = matrix.GetLength(0);
        var M = matrix.GetLength(1);
        var res = new long[N + 1, M + 1];
        for(int i = 0; i < N; ++i)
        {
          for(int j = 0; j < M; ++j)
          {
            res[i + 1, j + 1] = res[i, j + 1] + res[i + 1, j] - res[i, j] + matrix[i, j];
          }
        }
        return res;
      }
      public static Dictionary<T, long> Frequency<T>(T[] array)
      {
        var dict = new Dictionary<T, long>();
        foreach (var a in array)
        {
          if (!dict.ContainsKey(a)) { dict.Add(a, 0); }
          dict[a]++;
        }
        return dict;
      }

      public static readonly long P = 1000000007;
      public static T[,] Gen<T>(int r, int c, T v)
      {
        var matrix = new T[r, c];
        for (int i = 0; i < r; ++i)
        {
          for (int j = 0; j < c; ++j)
          {
            matrix[i, j] = v;
          }
        }
        return matrix;
      }

    }

    static class Read
{
static Queue<string> queue = new Queue<string>();
static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
public static ulong[] ULongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToUInt64(s)).ToArray(); }
public static string[] StrN() { return Console.ReadLine().Split(' '); }
public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
public static long[,] LongMatrix(int r, int c) { var mat = new long[r, c]; for (int i = 0; i < r; ++i) { var x = Read.LongN(); for (int j = 0; j < c; ++j) { mat[i, j] = x[j]; } } return mat; }
public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M, bool isDirectional = false)
{
Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
for (int i = 0; i <= N; ++i) { dict.Add(i, new HashSet<int>()); }
        for (int i = 0; i < M; ++i) { var ab = Read.IntN(); if (!dict[ab[0]].Contains(ab[1])) { dict[ab[0]].Add(ab[1]); } if (!isDirectional && !dict[ab[1]].Contains(ab[0])) { dict[ab[1]].Add(ab[0]); } }
        return dict;
}
public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
{
Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>(); for (int i = 0; i <= N; ++i) { dict.Add(i, new Dictionary<int, long>()); }
for (int i = 0; i < M; ++i) { var ab = Read.IntN(); dict[ab[0]].Add(ab[1], ab[2]); dict[ab[1]].Add(ab[0], ab[2]); }
return dict;
}
}
    }
}