program main
	implicit none
    character::s
    read(*,*)s
    if(s=='G')then
    	write(*,*)'C'
    else if(s=='C')then
    	write(*,*)'G'
    else if(s=='A')then
    	write(*,*) 'T'
    else
    	write(*,*) 'A'
        
    end if
    stop
end program main