function Main(input) {
  var helix = {
    "A": "T",
    "T": "A",
    "C": "G",
    "G": "C"
  };
  console.log(helix[input]);
}

process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(data){
  Main(data.trim());
});