program main
  implicit none
  character(len=1) :: b

  read(*,*) b

  if (b=='A') then
     write(*,'(A)') 'T'
  elseif (b=='T') then
     write(*,'(A)') 'A'
  elseif (b=='C') then
     write(*,'(A)') 'G'
  elseif (b=='G') then
     write(*,'(A)') 'C'
  end if
  stop
end program main
