b=eval(input())

print(('A' if b=='T' else 'T' if b=='A' else 'C' if b=='G' else 'G'))
s=eval(input())

print(('T' if s=='A' else 'G' if s=='C' else 'A' if s=='T' else 'C'))
b = eval(input())
print(("A" if b == "T" else "T" if b == "A" else "C" if b == "G" else "G"))

s = eval(input())
print(("T" if s == "A" else "G" if s == "C" else "A" if s == "T" else "C"))

-b = eval(input()) -print(("A" if b == "T" else "T" if b == "A" else "C" if b == "G" else "G")) +s = eval(input()) +print(("T" if s == "A" else "G" if s == "C" else "A" if s == "T" else "C"))