object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val b: String = sc.next()
  val pairs = Array("A" -> "T", "C" -> "G")
  val map = (pairs ++ pairs.map(_.swap)).toMap
  println(map(b))
}
