#include<iostream>
#include<conio.h>
#include<vector>
#include<queue>
#include<bits/stdc++.h>
#include<conio.h>
#include<cmath>
#include<string>
#include<stdio.h>
#include<algorithm>
#define ff first
#define ss second
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
using namespace std;
typedef long long ll;
typedef float fl;
typedef pair<int, int> pii;
typedef vector <int> vint;
typedef vector < pii > pvint;
typedef vector <bool> bvint;
typedef vector <vint> vvint;
const int inf=2e9;
int a[1000];
vvint t;
void build_tree(int v, int tl, int tr) {
if (tl == tr) {
t[v].push_back(a[tl]);
} else {
int tm = (tl + tr)/2;
build_tree(v*2,tl,tm);
build_tree(v*2+1,tm+1,tr);
t[v].resize(tr - tl + 1);
merge(t[v * 2].begin(), t[v*2].end(),t[v * 2 + 1].begin(),t[v * 2 + 1].end(), t[v].begin());
}
}
int main()
{
int n;cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];t.resize(2*n+1);
build_tree(1, 1, 5);//t.pb(0);
for(int i=1;i<2*n;i++){
for(int j=0;j<t[i].size(); j++) cout<<t[i][j]<< " "; cout<<endl;
}
cout<<endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNvbmlvLmg+CiNpbmNsdWRlPHZlY3Rvcj4KI2luY2x1ZGU8cXVldWU+CiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlPGNvbmlvLmg+CiNpbmNsdWRlPGNtYXRoPgojaW5jbHVkZTxzdHJpbmc+CiNpbmNsdWRlPHN0ZGlvLmg+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIHBiKGEpIHB1c2hfYmFjayhhKQojZGVmaW5lIG1rKGEsYikgbWFrZV9wYWlyKGEsYikKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgZmxvYXQgZmw7CnR5cGVkZW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