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