n,m = list(map(int,input().split())) a =[] for i in range(n): a.append( list(map(int,input().split() ))) for row in a: print(*row[::-1])