t=int(input())
if t>=1 and t<=1000:
for i in range(t):
n=int(input())
if n>=1 and n<=100000:
ni=str(n)
print (int(ni[::-1]))
t=int(input())
if t>=1 and t<=1000:
for i in range(t):
n=int(input())
if n>=1 and n<=100000:
ni=str(n)
print (int(ni[::-1]))