function Main(input) {

    var b = input;


    if (b == 'A') {
        console.log('T');
    } else if (b == 'C') {
        console.log('G');
    } else if (b == 'G') {
        console.log('C');
    } else if (b == 'T') {
        console.log('A');
    }

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));