function main(input) {
    const b = input.toString();

    var ans = '';

    switch (b) {
        case 'A':
            ans = 'T';
            break;
        case 'T':
            ans = 'A';
            break
        case 'G':
            ans = 'C';
            break
        case 'C':
            ans = 'G';
            break;
    }
    console.log(ans);
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
