program double_helix
  implicit none
  character(1) :: b
  read(*,*) b
  write(*,'(a)') achar(pair(ichar(b)-65)+65)
contains
  integer function pair(n)
    integer, intent(in) :: n
    pair = 12*(19-n)/(11*n+12)
  end
end program double_helix