a = [input(), input(), input()]
b = ['ABC', 'ARC', 'AGC', 'AHC']
for i in b:
    if i not in a:
        print(i)

fac3bd8fb3020176ac61b9ed49d0579e182c9d24
<mask token>

<mask token>
for i in b:
    if i not in a:
        print(i)

a = [input(), input(), input()]
b = ['ABC', 'ARC', 'AGC', 'AHC']
for i in b:
    if i not in a:
        print(i)
