import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val b = sc.next()

    if (b == "A") {
      println("T")
    }
    if (b == "C") {
      println("G")
    }
    if (b == "G") {
      println("C")
    }
    println("A")
  }
}