function Main(input) {

	switch (input) {
		case "A":
			console.log('T');
			break;
		case "T":
			console.log('A');
			break;
		case "G":
			console.log('C');
			break;
		case "C":
			console.log('G');
			break;
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));