Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- T = int(input())
- solved_grids = []
- i = 0
- while i < T:
- r, c, M, N = map(int, input().split())
- G = [input().split(" ") for _ in range(r)]
- for x in range(len(G)):
- G[x] = G[-(M % c):] + G[:-(M % c)]
- G = G[(N % r):] + G[:(N % r)]
- solved_grids.append(G)
- i += 1
- for grid in solved_grids:
- for row in grid:
- print(' '.join(row))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement