object double_helix {
  def main(args: Array[String]): Unit = {
    val out = io.StdIn.readLine.map {
      case 'A' => "T"
      case 'T' => "A"
      case 'C' => "G"
      case 'G' => "C"
    }
    println(out.head)
  }
}
  
