/*
#include <stdio.h>
int n, k;
int num[100001] = {0};
void search(int number, int first, int last)
{
int mid = (first+last)/2;
if (first>last) return;
if (first==last)
{
printf("%d", first + 1);
return;
}
if (num[mid] == number && num[mid-1] == number)
{
//printf("1 > %d %d\n", first, last);
search(number, first, mid-1);
}
else if (num[mid] == number)
{
//printf("2 > %d %d\n", first, last);
printf("%d", mid+1);
return;
}
else if (num[mid] > number)
{
//printf("3 > %d %d\n", first, last);
if (num[mid+1] < number)
{
printf("%d", mid+1);
return;
}
search(number, first, mid);
}
else if (num[mid] < number)
{
//printf("4 > %d %d\n", first, last);
if (first+1==last && num[last] > number)
{
printf("%d", last+1);
return;
}
if (first+1 == last && num[last] < number)
{
printf("%d", n+1);
return;
}
search(number, mid, last);
}
}
int main()
{
scanf("%d %d", &n, &k);
for (int i=0; i<n; i++)
{
scanf("%d", &num[i]);
}
search(k, 0, n-1);
}
*/
/*
#include <stdio.h>
int a[10001];
int n, i, j, temp;
int main()
{
scanf("%d", &n);
for (i=1; i<=n; i++)
scanf("%d", &a[i]);
for(i=1; i<n; i++)
{
for(j=1; j<=n-i; j++)
{
if (a[j] > a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
//printf("%d %d\n", i, j);
//printf("\n");
}
}
}
printf("\n");
for (i = 1; i <= n; i++)
printf("%d\n", a[i]);
return 0;
}
*/
/*
#include <stdio.h>
int main()
{
int tmp, n, num[1001] = {0};
int check=0, check2=0;
scanf("%d", &n);
for (int i=0; i<n; i++)
{
scanf("%d", &num[i]);
}
for (int i=0; i<n-1; i++)
{
check = 0;
for (int j=0; j<n-1; j++)
{
if (num[j]>num[j+1])
{
tmp = num[j];
num[j] = num[j+1];
num[j+1] = tmp;
check++;
}
}
if (check > 0)
{
check2++;
}
}
printf("%d", check2);
}
*/
/*
#include <stdio.h>
int a[10001];
int n, i, j, temp, min;
int main() {
scanf("%d", &n);
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (i=1; i<n; i++) {
min=i;
for (j=i+1; j<=n; j++) {
if (a[min] > a[j])
{
min = j;
}
}
temp = a[i];
a[i] = a[min];
a[min] = temp;
}
for (i=1; i<=n; i++)
printf("%d\n", a[i]);
return 0;
}
*/
#include <stdio.h>
int a[10001];
int n, i, j, temp, key;
int main() {
scanf("%d", &n);
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (i=2; i<=n; i++)
{
key=a[i];
for (j=i-1; key<a[j]; j--)
if (key < a[i-1])
{
a[j+1]=a[j];
printf("\n");
for (int k=1; k<=n; k++)
printf("%d\n", a[i]);
}
a[j+1]=key;
}
printf("\n");
for (i=1; i<=n; i++)
printf("%d\n", a[i]);
return 0;
}



