'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const b = args[0][0]
	if (b === 'A') console.log('T')
	else if (b === 'C') console.log('G')
	else if (b === 'G') console.log('C')
	else console.log('A')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
