function main(arg) {
	let x = arg.split("\n")[0]
	var g = ['A','C','G','T']
	var h = ['T','G','C','A']
	var ans = ''
	for (var i = 0; i < g.length; i++) {
		if (g[i] === x) {
			ans = h[i]
		}
	}
	console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));