function Main(input) {
   input = input.split("\n")[0]

    const getCounterPart = (s) => {
        switch (s){
          case 'A':
              return 'T'
          case 'T':
              return 'A'
          case 'C':
              return 'G'
          case 'G':
              return 'C'
        }
    }
    console.log(getCounterPart(input))
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))