import scala.io.StdIn._

object Main extends App {

  val b = readLine()

  def solve() = {
    b match {
      case "A" => "T"
      case "T" => "A"
      case "C" => "G"
      case "G" => "C"
    }
  }
  println(solve())

}

