object Main extends App {
    var get = readLine.split(" ")
    var i = 0
  for(i <- 0 to get.size-1){
	if(get(i)=="A")
      println("T")
    else if(get(i)=="T")
      println("A")
    else if(get(i)=="C")
      println("G")
    else
      println("C")
  }
}