a,b = map(int, input().split())
arr = []
for i in range(a):
    arr.append(input()[::-1])
for j in arr[::-1]:
    print(j)