import scala.collection.mutable.ArrayBuffer

object Main extends App {
  val n = readLine
  
  n match {
    case "A" => println("T")
    case "T" => println("A")
    case "C" => println("G")
    case "G" => println("C")
  }
}