fun main(args: Array<String>) {
    a104(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

fun a104(args: Array<String>) {
    if (args.size != 1) {
        throw IllegalArgumentException()
    }
    val rate = args[0].toInt()
    println(when {
        rate < 1200 -> "ABC"
        rate < 2800 -> "ARC"
        else -> "AGC"
    })
}

