solution.py
# 테스트 케이스 T 입력
T = int(input())
for test_case in range(1, T+1):
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
# 90도, 180,도 270도 회전한 행렬 초기화
arr1 = [[0 for _ in range(N)] for _ in range(N)]
arr2 = [[0 for _ in range(N)] for _ in range(N)]
arr3 = [[0 for _ in range(N)] for _ in range(N)]
# 90
for i in range(N):
for j in range(N):
arr1[i][j] = arr[N-1-j][i]
#180
for i in range(N):
for j in range(N):
arr2[i][j] = arr1[N-1-j][i]
#270
for i in range(N):
for j in range(N):
arr3[i][j] = arr2[N-1-j][i]
print('#{}'.format(test_case))
for i in range(N):
for a in range(N):
print(arr1[i][a], end='')
print(end=' ')
for b in range(N):
print(arr2[i][b], end='')
print(end=' ')
for c in range(N):
print(arr3[i][c], end='')
print()