import itertools

import math

import fractions

import functools

import copy

b = eval(input())

if b == "A":

    print("T")

if b == "T":

    print("A")

if b == "C":

    print("G")

if b == "G":

    print("C")

def main():

    # n = int(input())

    # n, m = map(int, input().split())

    # a = list(map(int, input().split()))

    s = eval(input())

    # h = [int(input()) for _ in rane(n)]

    if s == "A":

        print("T")

    if s == "T":

        print("A")

    if s == "C":

        print("G")

    if s == "G":

        print("C")





if __name__ == '__main__':

    main()

import itertools
import math
import fractions
import functools
import copy

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

def main():
    # n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    s = eval(input())
    # h = [int(input()) for _ in rane(n)]
    if s == "A":
        print("T")
    if s == "T":
        print("A")
    if s == "C":
        print("G")
    if s == "G":
        print("C")


if __name__ == "__main__":
    main()

-import itertools -import math -import fractions -import functools -import copy +def main(): +    # n = int(input()) +    # n, m = map(int, input().split()) +    # a = list(map(int, input().split())) +    s = eval(input()) +    # h = [int(input()) for _ in rane(n)] +    if s == "A": +        print("T") +    if s == "T": +        print("A") +    if s == "C": +        print("G") +    if s == "G": +        print("C") -b = eval(input()) -if b == "A": -    print("T") -if b == "T": -    print("A") -if b == "C": -    print("G") -if b == "G": -    print("C") + +if __name__ == "__main__": +    main()