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