object double_helix {
  def main(args: Array[String]): Unit = {
    val input = io.Source.stdin.getLines().mkString("\n")
    input match {
      case "A" => println("T")
      case "T" => println("A")
      case "C" => println("G")
      case "G" => println("C")
    }

  }
}