b = eval(input())

if b == "T":

  print ("A")

elif b == "A":

  print ("T")

elif b == ("G"):

  print ("C")

else:

  print ("G")
array = ["A","T","G","C"]

b = eval(input())

if b == array[0]:

  print((array[1]))

elif b == array[1]:

  print((array[0]))

elif b == array[2]:

  print((array[3]))

else:

  print((array[2]))
b = eval(input())
if b == "T":
    print("A")
elif b == "A":
    print("T")
elif b == ("G"):
    print("C")
else:
    print("G")

array = ["A", "T", "G", "C"]
b = eval(input())
if b == array[0]:
    print((array[1]))
elif b == array[1]:
    print((array[0]))
elif b == array[2]:
    print((array[3]))
else:
    print((array[2]))

+array = ["A", "T", "G", "C"] -if b == "T": -    print("A") -elif b == "A": -    print("T") -elif b == ("G"): -    print("C") +if b == array[0]: +    print((array[1])) +elif b == array[1]: +    print((array[0])) +elif b == array[2]: +    print((array[3])) -    print("G") +    print((array[2]))