#include<bits/stdc++.h>
using namespace std;
int main(){
  int z;
  cin>>z;
  if(z<1200) cout<<"ABC"<<endl;
  else if(z<2800) cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;
}
#include <iostream>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    string s;
    cin >> s;
    s[3]='8';
    cout << s << endl;

    return 0;
}
