function Main(input) {
  input = input.trim()
  var A=0;
  switch(input){
    case "A":
      A="T"
      break;
    case "G":
       A = "C"      break;
    case "T":
      A = "A"      break;
    case "C":
      A ="G"      break;
              }
  console.log(A)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));