#include <stdio.h>
#include <iostream>

using std::cout;
using std::cin;
using std::endl;
using std::string;

void BubbleSort(int a[], int n)
{
   int i,j,t;
   for(i=n-1;i>=0;i--)
      for(j=1;j<=i;j++)
         if(a[j-1]>a[j])
         {
            t=a[j-1];
            a[j-1]=a[j];
            a[j]=t;
         };
}

void main()
{
   int Pole[] = {1, 2, 5, 6, 3, 8, 4, 7, 9};
   for (int i= 0; i<9;i++) cout<<Pole[i];
   cout<<endl;
   cout<<endl;
   BubbleSort(Pole, 8);
   for (int j= 0; j<9;j++) cout<<Pole[j];
   cout<<endl;
   cout<<endl;


}