#include <bits/stdc++.h>
using namespace std;
int a[10005];
int main()
{
int n;
cin >> n;
srand(time(0)); //随机数发生器
for (int i = 1; i <= n; i++)
a[i] = rand() % 100; //产生0--99的随机数
for (int i = 1; i <= n - 1; i++)
cout << a[i] << " ";
cout << a[n] << endl;
for (int i = 2; i <= n; i++)
{
int t = a[i];
int prei = i - 1;
while (a[prei] > t)
{
a[prei + 1] = a[prei];
prei--;
}
a[prei + 1] = t;
}
for (int i = 1; i <= n - 1; i++)
cout << a[i] << " ";
cout << a[n] << endl;
return 0;
}