import java.util.Scanner

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val b = sc.nextLine()
    val r = b match {
      case "A" => "T"
      case "T" => "A"
      case "C" => "G"
      case "G" => "C"
    }

    println(s"$r")
  }
}
