import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  val map = mapOf( "A" to "T", "C" to "G", "T" to "A", "G" to "C")
  val ans = map[br.readLine()]
  println(ans)
}