#!/usr/bin/env python n=input() a_list=map(int,raw_input().split(" ")) buf=0 for i in range(1,2*n-3): for p in range(n-1): q=i-p if pa_list[q]: a_list[p],a_list[q]= a_list[q],a_list[p] # buf=a_list[p] # a_list[p]=a_list[q] # a_list[q]=buf print " ".join(map(str,a_list))