function main(input) {
  const S = input.toString();
  if (S === 'A') {
    console.log('T');
  } else if (S === 'T') {
    console.log('A');
  } else if (S === 'C') {
    console.log('G');
  } else if (S === 'G') {
    console.log('C');
  }
}

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