import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun p(value: Any?) {
    pw.println(value)
}

fun solve() {
    val b = readLine()!!
    val mp = mapOf("A" to "T", "T" to "A", "C" to "G", "G" to "C")
    p(mp[b])
}

fun main(args: Array<String>) {
    solve()
    pw.flush()
}