print(("A"+"BRG"[(int(eval(input()))+400)//1600]+"C"))

print(("A"+"BRG"[int(eval(input()))//50+8>>5]+"C"))
print(("A" + "BRG"[(int(eval(input())) + 400) // 1600] + "C"))

print(("A" + "BRG"[int(eval(input())) // 50 + 8 >> 5] + "C"))

-print(("A" + "BRG"[(int(eval(input())) + 400) // 1600] + "C")) +print(("A" + "BRG"[int(eval(input())) // 50 + 8 >> 5] + "C"))