import sys a, b = input().split() x = list() for line in sys.stdin: x.append(line.split()[0]) y = x[::-1] for item in y: print(item[::-1])