function main(input) {
    const args = input.split(' ');
    var b = args[0];

    if(b == 'A') {
        console.log('T')
    } 
    else if(b == 'G') {
        console.log('C')
    } 
    else if (b == 'T') {
        console.log('A')
    } 
    else if (b == 'C') {
        console.log('G')
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

