for tc in range(1,10+1):
arr_l = int(input())
arr=list(input().split())
c_l = int(input())
c=list(input().split())
for i in range(len(c)):
if c[i]=='I':
tmp=c[i+3 : i+3+int(c[i+2])]
arr[int(c[i+1]):int(c[i+1])]=tmp
res=' '.join(arr[0:10])
print(f'#{tc} {res}')
명령어 위치를 기준으로 나머지를 파악한다.