
function Main(input) {
    var dict = {
      A:'T',
      T:'A',
      C:'G',
      G:'C',
    };
	var char = input;
	console.log(dict[char]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));