b = eval(input())

if b == "A":

  print("T")

if b == "T":

  print("A")

if b == "G":

  print("C")

if b == "C":

  print("G")
d = {"A":"T","T":"A","C":"G","G":"C"}

print((d[eval(input())]))
b = eval(input())
if b == "A":
    print("T")
if b == "T":
    print("A")
if b == "G":
    print("C")
if b == "C":
    print("G")

d = {"A": "T", "T": "A", "C": "G", "G": "C"}
print((d[eval(input())]))

-b = eval(input()) -if b == "A": -    print("T") -if b == "T": -    print("A") -if b == "G": -    print("C") -if b == "C": -    print("G") +d = {"A": "T", "T": "A", "C": "G", "G": "C"} +print((d[eval(input())]))