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