fun main(args: Array<String>) {
    val s = readInputLine()
    
    if (s == "A") {
        println("T")
    } else if (s == "T") {
        println("A")
    } else if (s == "C") {
        println("G")
    } else if (s == "G") {
        println("C")
    }
}

fun readInputLine(): String {
    return readLine()!!
}
