function main(input){
  input=input.split("\n")
  if(input=="A"){
    console.log("T");
  }else if(input=="C"){
    console.log("G");
  }else if(input=="G"){
    console.log("C");
  }else{
    console.log("A");
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));