const main = stdin => {
  const input = stdin.trim().split('\n')

  const b = input[0]
  switch (b) {
    case 'A':
      console.log('T')
      break;
    case 'T':
      console.log('A')
      break;
    case 'C':
      console.log('G')
      break;
    case 'G':
      console.log('C')
      break;
    default:
      break;
  }
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
