object Main {
  val sc = new java.util.Scanner(System.in)

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val map = Map("A" -> "T", "C" -> "G", "T" -> "A", "G" -> "C")

    println(map(sc.next))

  }
}