function main(b){
	var a;
	switch(b){
		case "A": a="T";break;
		case "T": a="A";break;
		case "G": a="C";break;
		case "C": a="G";break;
	}
	console.log(a);
}

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