object Main extends App {
  val sc = new java.util.Scanner(System.in)
//  val l = List.fill(5)(sc.nextInt)
  val b = sc.next

  val map = Map("A" -> "T", "T" -> "A", "C" -> "G", "G" -> "C")
  println(map(b))
}