import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(string b) {
    return [
        "A": "T",
        "T": "A",
        "C": "G",
        "G": "C"
    ][b];
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    string b;
    b = input.front.to!string;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(b);
    else
        solve(b).writeln;
}
