import sys



b = eval(input())

if b == 'A':

	print('T')

elif b == 'T':

	print('A')

elif b == 'G':

	print('C')

elif b == 'C':

	print('G')
import sys

input=sys.stdin.readline().strip



b = eval(input())

if b == 'A':

	print('T')

elif b == 'T':

	print('A')

elif b == 'G':

	print('C')

elif b == 'C':

	print('G')
import sys

b = eval(input())
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "G":
    print("C")
elif b == "C":
    print("G")

import sys

input = sys.stdin.readline().strip
b = eval(input())
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "G":
    print("C")
elif b == "C":
    print("G")

+input = sys.stdin.readline().strip