print(('A'+'BRG'[int(eval(input()))//100+4>>4]+'C'))
print('A%sC'%'BRG'[eval(input())/100+4>>4])
print(("A" + "BRG"[int(eval(input())) // 100 + 4 >> 4] + "C"))

print("A%sC" % "BRG"[eval(input()) / 100 + 4 >> 4])

-print(("A" + "BRG"[int(eval(input())) // 100 + 4 >> 4] + "C")) +print("A%sC" % "BRG"[eval(input()) / 100 + 4 >> 4])