function Main(input) {
    var mozi = input[0];
    
    var result = '';
    if (mozi === 'A') {
        result = 'T';
    } else if (mozi === 'T') {
        result = 'A';
    } else if (mozi === 'C') {
        result = 'G';
    } else if (mozi === 'G') {
        result = 'C';
    }
    console.log(result);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));