#include <bits/stdc++.h>

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   ll r;cin>>r;
   if(r<1200)puts("ABC");
   else if(r<2800)puts("ARC");
   else puts("AGC");
   return 0;
}
#include "iostream"
#include "string"
using namespace std;
int main(){
  string a;
  cin>>a;
  a[3]='8';
  cout<<a<<endl;
}
