const main = (input) => {
  input = input.trim();
  const map = {
    A: 'T',
    T: 'A',
    C: 'G',
    G: 'C',
  };

  console.log(map[input]);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
