"use strict";
function Main(input) {
    let b = input.split("\n")[0].split(/\s/)[0];
    let ans;
    switch (b) {
        case 'A': ans = 'T'; break;
        case 'C': ans = 'G'; break;
        case 'T': ans = 'A'; break;
        case 'G': ans = 'C'; break;
        default: ;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
