program main
  implicit none
  character(len=1) :: b
  
  read *, b
  select case (b)
  case ('A')
    print '(a1)', 'T'
  case ('T')
    print '(a1)', 'A'
  case ('G')
    print '(a1)', 'C'
  case ('C')
    print '(a1)', 'G'
  end select
end program