import java.util.Scanner

fun main(args: Array<String>) {
  print(
    when (Scanner(System.`in`).next()) {
      "G" -> "C"
      "C" -> "G"
      "A" -> "T"
      "T" -> "A"
      else -> ""
    }
  )
}