7-22 sdut-矩阵输出
n=int(input())
num=[int(x) for x in input().split()]
for i in range(n):
print(" ".join(map(str,num)))
t=num[-1]
num.pop()
num.insert(0,t)
n=int(input())
num=[int(x) for x in input().split()]
for i in range(n):
print(" ".join(map(str,num)))
t=num[-1]
num.pop()
num.insert(0,t)