void mult(int x,int a[]) { int k=0; for(int i=1;i<=a[0];i++) { int tmp=a[i]*x+k; a[i]=tmp%10; k=tmp/10; } while(k)a[++a[0]]=k%10,k/=10; }
void getpri() { for(int i=2;i<=10000;i++) { if(!vis[i])pri[++tot]=i; for(int j=1;j<=tot;j++) { if(i*pri[j]>10000)break; vis[i*pri[j]]=1; if(i%pri[j]==0)break; } } }
void getprime() { for(int i=2;i<=2*n;i++) { if(!vis[i])pri[++tot]=i,res[i]=tot; for(int j=1;j<=tot;j++) { if(i*pri[j]>2*n)break; vis[i*pri[j]]=1;res[i*pri[j]]=j; if(i%pri[j]==0)break; } } } void divi(int x,int val) { while(x!=1)bu[res[x]]+=val,x/=pri[res[x]]; }
void Minus(int a[],int b[]) { int j=1,x=0; while(j<=a[0]||j<=b[0]) { if(a[j]<b[j]) { a[j]+=10; a[j+1]--; } ans[j]=a[j]-b[j]; j++; } int k=j; while(ans[k]==0&&k>1)k--; ans[0]=k; }
void add(int m[],int n[]) { int j=1,x=0; while(j<=m[0]||j<=n[0]) { c[j]=m[j]+n[j]+x; x=c[j]/10; c[j]%=10; j++; } c[j]=x; if(c[j]==0)j--; for(int i=j;i>=1;i--) cout<<c[i]; }
void dx(int m[],int n[]) { for(int i=1;i<=m[0];i++) { int x=0; for(int j=1;j<=n[0];j++) { c[i+j-1]=m[i]*n[j]+x+c[i+j-1]; x=c[i+j-1]/10; c[i+j-1]%=10; } c[i+n[0]]=x; } c[0]=m[0]+n[0]; while(c[c[0]]==0&&c[0]>1)c[0]--; for(int i=c[0];i>=1;i--)cout<<c[i]; }
const int L=1<<20|1; char buffer[L],*S,*T; #define getchar() ((S==T&&(T=(S=buffer)+fread(buffer,1,L,stdin),S==T))?EOF:*S++)
#include <iostream> int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); return 0; }
void cnt_fact() { vis[1]=d[1]=1; for(int i=2;i<=M;i++) { if(!vis[i])pr[++cnt]=i,d[i]=2,a[i]=1;// i is a prime number. for(int j=1;j<=cnt&&i*pr[j]<=M;j++) { vis[i*pr[j]]=1; if(i%pr[j])d[i*pr[j]]=d[i]*d[pr[j]],a[i*pr[j]]=1;//If i and pr[j] are coprime else// If they are not coprime,i must include at least one pr[j]. { d[i*pr[j]]=d[i]/(a[i]+1)*(a[i]+2);//And pr[j] should be the minimum prime factor of i. a[i*pr[j]]=a[i]+1;break; } } } }
void ini() { mu[1]=1; for(int i=2;i<=M-5;i++) { if(!vis[i])pr[++tot]=i,mu[i]=-1; for(int j=1;j<=tot&&i*pr[j]<=M-5;j++) { vis[i*pr[j]]=1; if(i%pr[j])mu[i*pr[j]]=-mu[i]; else { mu[i*pr[j]]=0; break; } } } }
#include<cstdio> #include<cstring> using namespace std; int const N=1e5+5; inline void swap(int &x,int &y){ x^=y^=x^=y; return ; } struct node{ //大根堆 int heap[N],n; inline void clear(){ //清空 n=0; return ; } inline bool empty(){ //判斷是否爲空 return !n; } inline int size(){ //返回元素個數 return n; } inline void up(int x){ //向上調整 while(x^1) if(heap[x]>heap[x>>1])swap(heap[x],heap[x>>1]),x>>=1; else return ; } inline void down(int x){ //向下調整 int s=x<<1; while(s<=n){ if(s<n && heap[s]<heap[s|1])s|=1; if(heap[s]>heap[x]){swap(heap[s],heap[x]);x=s,s<<=1;} else return ; } } inline void push(int x){ //插入元素x heap[++n]=x; up(n); return ; } inline int top(){return heap[1];} //返回堆中的最大值 inline void pop(){heap[1]=heap[n--];down(1);return ;} //刪除堆頂 inline void erase(int x){ //刪除下標爲x的節點 heap[x]=heap[n--]; up(x),down(x); return ; } inline int* begin(){ //返回堆中第一個元素的指針(實在不會搞迭代器……) return &heap[1]; } inline int* end(){ //返回堆的尾部邊界 return &heap[n+1]; } inline int &operator [] (int x){ return heap[x]; } }q; int main(){ //freopen("1.in","r",stdin); //freopen("1.out","w",stdout); int t; scanf("%d",&t); for(register int i=1;i<=t;++i){ int z; scanf("%d",&z); q.push(z); } for(register int* i=q.begin();i!=q.end();++i) //遍歷1 printf("%d ",*i); puts(""); for(register int i=1;i<=q.size();++i) //遍歷2 printf("%d ",q[i]); puts(""); while(!q.empty()){ //從大到小輸出 printf("%d ",q.top()); q.pop(); } puts(""); return 0; }