object Main {
  def main(args: Array[String]): Unit = {
    val b = io.StdIn.readChar()
    println {
      b match {
        case 'A' => 'T'
        case 'T' => 'A'
        case 'C' => 'G'
        case 'G' => 'C'
      }
    }
  }
}
