#include<bits/stdc++.h>
using namespace std;
const int N=25;
void bubble_sort(int a[],int n)
{
int end=n-1;
while(end>=1)
{
for(int i=1;i<=end;i++)
{
if(a[i+1]<a[i])swap(a[i+1],a[i]);
}
end--;
}
return;
}
void insert_sort(int a[],int n)
{
for(int i=2;i<=n;i++)
{
int pos=i;
while(pos>1&&a[pos]<a[pos-1])
{
swap(a[pos],a[pos-1]);
pos--;
}
}
return;
}
void select_sort(int a[],int n)
{
for(int i=1;i<=n;i++)
{
int minn=0x3f3f3f3f;
int pos;
for(int j=i;j<=n;j++)
{
if(a[j]<minn)
{
minn=min(a[j],minn);
pos=j;
}
}
swap(a[i],a[pos]);
}
return;
}
int main()
{
int n=0;
int a[N];
for(int i=0;i<18;i++)
{
int x;
cin>>x;
if(x)
{
a[++n]=x;
}else
{
break;
}
}
cout<<"1-Bubble Sort,2-Insert Sort,3-Select Sort"<<endl;
int op;
cin>>op;
if(op==1)
{
bubble_sort(a,n);
}else if(op==2)
{
insert_sort(a,n);
}else if(op==3)
{
select_sort(a,n);
}
for(int i=1;i<=n;i++)
{
if(i!=n)
cout<<a[i]<<",";
else
cout<<a[i]<<endl;
}
return 0;
}