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