function main(input) {
  var str = input.split("\n");
  switch (str[0]) {
    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'));
