Complementing DNA

Limits 5s, 512 MB

In DNA strings, symbols 'A' and 'T' are complements of each other, as are 'C' and 'G'.

The reverse complement of a DNA string S is the string Sc formed by reversing the symbols of S, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC").
You will be given with a DNA string S of length at most 1000. You task is to write a program that will display the reverse complement Sc of S.


First line contains the number of test cases T. The following T lines contain the DNA sequences S


For each line of input produce one-line output, displaying reverse complement string Sc.



Explanation of the sample case: For the given string GTCA, we take the reverse, that is ACTG. Then we replace each letter with its compliments and get TGAC.