list1=input().split()
list1[1]=int(list1[1])
list=[]
k=0
for i in range(list1[1]):
a=input()
list.append(a)
for i in range(list1[1]//2):
if list[i]!=list[len(list)-1-i]:
k=1
break
if k==0:
print("bu yong dao le")
for i in range(list1[1]-1,-1,-1):
list2=list[i]
for j in range(len(list2)-1,-1,-1):
t=list2[j]
if t==" ":
print(" ",end="")
else:
print(list1[0],end="")
print()