/**********************************************************************************************
-> @author : a_e_kasem
-> "Code is an art — let logic be your ink and syntax your rhythm."
***********************************************************************************************/
//*------------------------------------------------------------------------------------------*//
// ﷽
// { وَأَنْ لَيْسَ لِلْإِنْسَانِ إِلَّا مَا سَعَى }
//
// فَالجُهدُ يُثمِرُ إنْ تَضافَرَ صَفوُهُ، والعَزمُ يَرفعُ صَرحَ كُلِّ بُنيانِ
//
// وَما نَيلُ المَطالِبِ بِالتَمَنّي
// وَلَكِن تُؤخَذُ الدُنيا غِلابا
// ***
// وَما اِستَعصى عَلى قَومٍ مَنالٌ
// إِذا الإِقدامُ كانَ لَهُم رِكابا
//*------------------------------------------------------------------------------------------*//
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define cinAll(a) for (auto &it : a) cin >> it
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define NO void(cout << "NO\n")
#define YES void(cout << "YES\n")
#define endl "\n"
const int INF = 1e18;
const int MOD = 998244353;
const int MAXN = 2e5 + 5;
int n;
vector<int> a, path;
vector<vector<int>> ans;
void go(int i){
if (i == n)
{
ans.push_back(path);
return;
}
path.push_back(a[i]);
go(i+1);
path.pop_back();
go(i+1);
}
void solve()
{
cin >> n;
a.resize(n);
for (int i = 0; i < n; i++)
cin >> a[i];
go(0);
sort(ans.begin(), ans.end());
for (int i = 0; i < ans.size(); i++)
{
for (int j = 0; j < ans[i].size(); j++)
{
cout << ans[i][j] << " ";
}
cout << endl;
}
}
void FastIO();
int32_t main()
{
FastIO();
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
void FastIO()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}