import scala.io.StdIn

object Main {

  def cmp: PartialFunction[Char, Char] = {
    case 'A' => 'T'
    case 'G' => 'C'
    case 'C' => 'G'
    case _   => 'A'
  }

  def main(args: Array[String]): Unit = {

    val b = StdIn.readChar()
    val ans = cmp(b)
    println(ans)
  }

}
