# Enter your code here. Read input from STDIN. Print output to STDOUT
import base64
T = input()

while T > 0:
    T -= 1
    print base64.b64encode(base64.b32decode(raw_input()))