#include <bits/stdc++.h>
using namespace std;
char s[10009];//定义输入的字符串
int main(){
cin>>s;//输入
for (int i=0;i<strlen(s);i++)//一一列举字符串的每一个字母
if (s[i]=='A') cout<<"T";//对应配对归侓
else if (s[i]=='G') cout<<"C";//对应配对归侓
else if (s[i]=='T') cout<<"A";//对应配对归侓
else if (s[i]=='C') cout<<"G";//对应配对归侓
return 0;
}