function Main(input){
	if(input === 'A'){
    console.log('T')
    }else if(input === 'C'){
    console.log('G')
    }else if(input === 'G'){
    console.log('C')
    }else if(input === 'T'){
    console.log('A')
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));