function main(input) {
   input = input.trim();
  const a = input.split("");
 
	console.log(a[0]=="A"?"T"
			   :a[0]=="C"?"G"
	 		   :a[0]=="G"?"C"
			   :"A");
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));