function main(input) {
    const pair = new Map();
    pair.set('A','T');
    pair.set('T','A');
    pair.set('C','G');
    pair.set('G','C');
    console.log(pair.get(input.trim()));    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));