#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int partition(int a[],int low,int high)
{
int temp=a[low];
while(low<high)
{
while(low<high&&temp<a[high])--high;
a[low]=a[high];
while(low<high&&a[low]<temp)++low;
a[high]=a[low];
}
a[low]=temp;
return low;
}
void qsort(int a[],int low,int high)
{
if(low<high)
{
int index=partition(a,low,high);
qsort(a,low,index-1);
qsort(a,index+1,high);
}
}
int main()
{
int a[4]= {2,1,4,3};
qsort(a,0,3);
for(int i=0; i<4; i++)
cout<<a[i]<<endl;
return 0;
}