function Main(input) {
    var ans;
    if(input === 'A') ans = 'T';
    if(input === 'T') ans= 'A';
    if(input === 'C') ans='G';
    if(input === 'G') ans='C';
    console.log(ans)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));