"use strict";
    
const main = arg => {
    const b = arg.split("\n")[0];
    
    if(b == "A") {
        console.log("T");
    } else if (b == "T") {
        console.log("A");
    } else if (b == "C") {
        console.log("G");
    } else if (b == "G") {
        console.log("C");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
