#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


    int r;
    cin >> r;
    if (r < 1200) {
        cout << "ABC\n";
    } else if (r < 2800) {
        cout << "ARC\n";
    } else {
        cout << "AGC\n";
    }

    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
    string s; cin >> s;
    if (s == "SSS") {
        cout << 0 << endl;
        return 0;
    }
    int ans = 1;
    if (s[0] == 'R' && s[1] == 'R') ans++;
    if (s[1] == 'R' && s[2] == 'R') ans++;
    cout << ans << endl;
}
