program main
    use,intrinsic :: iso_fortran_env
    implicit none
    character(1):: b

    read*, b
    if (b == 'A') then
        print'(a)', 'T'
    else if (b == 'G') then
        print'(a)', 'C'
    else if (b == 'T') then
        print'(a)', 'A'
    else
        print'(a)', 'G'
    end if
end program main