import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto b = readln.split[0];
    if (b == "A") "T".writeln;
    if (b == "T") "A".writeln;
    if (b == "G") "C".writeln;
    if (b == "C") "G".writeln;
}
