import scala.io.{StdIn => in}

object Main extends App {
  val b = in.readLine
  val ans = b match {
    case "A" => "T"
    case "C" => "G"
    case "T" => "A"
    case "G" => "C"
  }

  println(ans)
}