function Main(input){  
     var input = input.split("\n");
     var inputs = input[0];
    
	if(inputs === 'A'){
    console.log('T');
    }else if(inputs === 'C'){
    console.log('G');
    }else if(inputs === 'G'){
    console.log('C');
    }else if(inputs === 'T'){
    console.log('A');
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));