import Control.Applicative

main :: IO ()
main = do
    a <- getLine
    putStrLn $ solve a 
    
solve :: String -> String 
solve a | a == "A" = "T"
        | a == "T" = "A"
        | a == "G" = "C"
        | a == "C" = "G"