function main(input) {
    var ret = "";
    switch(input){
      case "A":
        ret = "T";
        break;
      case "T":
        ret = "A";
        break;
      case "C":
        ret = "G";
        break;
      case "G":
        ret = "C";
        break;
    }
    console.log(ret);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));