function Main(input) {
	input = input.trim();
  var list = {
    "A" : "T",
    "T" : "A",
    "C" : "G",
    "G" : "C"
  };
  console.log(list[input]);
  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
