import Control.Monad
import Control.Applicative
import Data.List

-- e.g.
-- 1
-- [a] <- map read . words <$> getline => [1] -> a == 1
-- 1
-- a <- readlLn
-- 1 2 3
-- lst <- map read . words <$> getLine => [1, 2, 3]
-- 1 2 3
-- [l, m, n] <- map read . words <$. getLine :: IO [Int] => [1, 2, 3]
-- 'a'
-- c <- getChar => c == 'a'

main :: IO()
main = do
  c <- getChar
  let ans = case c of
              'A' -> 'T'
              'G' -> 'C'
              'T' -> 'A'
              'C' -> 'G'

  putStrLn [ans]
