n=int(input()) a=list(map(int,input().split())) for i in range(1,2*n-3): for p in range(i//2+1): q=i-p if pa[q]: a[p],a[q]=a[q],a[p] a=[str(x) for x in a] print(" ".join(a))