import std.stdio, std.range, std.conv, std.string, std.array, std.functional;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.setops, std.algorithm.sorting;
import std.container.binaryheap;

void main()
{

    char input;
    scanf("%c", &input);
    if(input == 'A')
    {
        writeln("T");
    }
    if(input == 'T')
    {
        writeln("A");
    }
    if(input == 'G')
    {
        writeln("C");
    }
    if(input == 'C')
    {
        writeln("G");
    }
}
