function Main(input) {
  input = input.toString();
  if (input === "A") {
    console.log("T");
  } else if ( input === "T") {
    console.log("A");
  } else if ( input === "G") {
    console.log("C");
  } else if (input === "C") { 
    console.log("G");
  }
}

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