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