object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val b = sc.next.charAt(0)
  val result = if (b == 'A') {
    'T'
  } else if (b == 'T') {
    'A'
  } else if (b == 'C') {
    'G'
  } else if (b == 'G') {
    'C'
  }
  println(result)
}