#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int GetStrFromStrm(char* szBuff, int buffSize, FILE* strm);
int Tokenize(const char* srcStr, const char* dlmtr, std::vector<std::string>& tokens);

int GetIntFromStream(FILE* strm);
int GetIntsFromStream(std::vector<int>& vInts, FILE* strm, size_t bufSize);

unsigned long long GetUllFromStream(FILE* strm);
int GetUllsFromStream(std::vector<unsigned long long>& vUlls, FILE* strm, size_t bufSize);

/* 書式文字列: %s %c %ll (long long) %llu (unsigned long long) */

static void A_DoubleHelix();



int main()
{
	A_DoubleHelix();

	fflush(stdout);
	return 0;
}



int GetStrFromStrm(char* szBuff, int buffSize, FILE* strm = stdin)
{
	int len = 0;

	while (len == 0) {
		fgets(szBuff, buffSize, strm);
		

		// 最初のスペースは除く
		int spaceCnt = 0;
		for(int i = 0; i < buffSize; i++) {
			if (isspace(szBuff[i])) {
				spaceCnt++;
			}
			else {
				break;
			}
		}
		for (int i = spaceCnt; i < buffSize; i++) {
			szBuff[i - spaceCnt] = szBuff[i];
			if (szBuff[i] == '\0') {
				break;
			}
		}

		char* n;
		if ((n = strchr(szBuff, '\n'))) {
			*n = '\0';
		}
		len = strlen(szBuff);
	}
	return len;
}

int Tokenize(const char* srcStr, const char* dlmtr, std::vector<std::string>& tokens)
{
	size_t pos = 0, ofs = 0, len = 0;
	size_t dlmtrLen = strlen(dlmtr);
	std::string target = srcStr;

	pos = target.find(dlmtr, ofs);
	tokens.push_back(target.substr(0, pos));
	ofs = pos + dlmtrLen;
	while (pos != std::string::npos) {

		pos = target.find(dlmtr, ofs);

		if (pos != std::string::npos) {
			len = pos - ofs;
		}
		else {
			len = strlen(srcStr) - ofs;
		}
		tokens.push_back(target.substr(ofs, len));
		ofs = pos + dlmtrLen;
	}

	return 0;
}

unsigned long long GetUllFromStream(FILE* strm = stdin)
{
	char szNum[64] = { 0 };

	GetStrFromStrm(szNum, sizeof(szNum), stdin);

	return (strtoull(szNum, NULL, 10));
}


int GetUllsFromStream(std::vector<unsigned long long>& vUlls, FILE* strm = stdin, size_t bufSize = 4092)
{
	char * szNum = new char[bufSize];
	memset(szNum, 0, bufSize);

	GetStrFromStrm(szNum, bufSize, stdin);

	std::vector<std::string> tokens;
	Tokenize(szNum, " ", tokens);

	int tokenCnt = tokens.size();
	for (int i = 0; i < tokenCnt; i++) {
		vUlls.push_back(strtoull(tokens[i].c_str(), NULL, 10));
	}

	delete[] szNum;

	return tokenCnt;
}

int GetIntFromStream(FILE* strm = stdin)
{
	char szNum[64] = { 0 };

	GetStrFromStrm(szNum, sizeof(szNum), stdin);

	return (strtoul(szNum, NULL, 10));
}


int GetIntsFromStream(std::vector<int>& vInts, FILE* strm = stdin, size_t bufSize = 4092)
{
	char * szNum = new char[bufSize];
	memset(szNum, 0, bufSize);

	GetStrFromStrm(szNum, bufSize, stdin);

	std::vector<std::string> tokens;
	Tokenize(szNum, " ", tokens);

	int tokenCnt = tokens.size();
	for (int i = 0; i < tokenCnt; i++) {
		vInts.push_back((int)(strtol(tokens[i].c_str(), NULL, 10)));
	}

	delete[] szNum;

	return tokenCnt;
}

static void A_DoubleHelix()
{
	char b = 0;
	char ans = 0;
	scanf(" %c", &b);

	switch (b)
	{
	case 'A':
		ans = 'T';
		break;
	case 'T':
		ans = 'A';
		break;
	case 'C':
		ans = 'G';
		break;
	case 'G':
		ans = 'C';
		break;
	default:
		break;
	}

	printf("%c\n", ans);
}


Measured memory_bytes: 256