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

print((a[eval(input())]))

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

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

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