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

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

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