import sys

b = eval(input())

if not ( b == 'A' or b == 'T' or b == 'G' or b == 'C' ): sys.exit()



if b == 'T': print('A')

if b == 'A': print('T')

if b == 'C': print('G')

if b == 'G': print('C')
import sys

b = eval(input())

if not ( b == 'A' or b == 'T' or b == 'G' or b == 'C' ): sys.exit()

base = { 'A':'T', 'T':'A', 'G':'C', 'C':'G' }



print((base[b]))
import sys

b = eval(input())
if not (b == "A" or b == "T" or b == "G" or b == "C"):
    sys.exit()
if b == "T":
    print("A")
if b == "A":
    print("T")
if b == "C":
    print("G")
if b == "G":
    print("C")

import sys

b = eval(input())
if not (b == "A" or b == "T" or b == "G" or b == "C"):
    sys.exit()
base = {"A": "T", "T": "A", "G": "C", "C": "G"}
print((base[b]))

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