import std.stdio, std.conv, std.string, std.math, std.regex, std.range, std.ascii, std.algorithm;

void main(){
	auto ip = readln.chomp;

	switch(ip){
		case "A":
			writeln("T");
			break;
		case "T":
			writeln("A");
			break;
		case "C":
			writeln("G");
			break;
		case "G":
			writeln("C");
			break;
		default:
	}
}