/*
#include <iostream>
using namespace std;
int main()
{
int n,a[1001],b[1001],c[1001],temp;
cin>>n;
for(int i=0; i<n; i++)
{
cin>>a[i]>>b[i];
}
for(int i=1; i<=n; i++)
{
c[i-1]=i;
}
for(int i=0; i<n; i++)
{
for(int j=0; j<n-1; j++)
{
if(a[j] < a[j+1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
temp = b[j];
b[j] = b[j+1];
b[j+1] = temp;
temp = c[j];
c[j] = c[j+1];
c[j+1] = temp;
}
}
}
for(int i=0; i<n; i++)
{
for(int j=0; j<n-1; j++)
{
if(a[j] < a[j+1] && b[j] < b[j+1])
{
temp = b[j];
b[j] = b[j+1];
b[j+1] = temp;
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
temp = c[j];
c[j] = c[j+1];
c[j+1] = temp;
}
else if(a[j] == a[j+1] && b[j] < b[j+1])
{
temp = b[j];
b[j] = b[j+1];
b[j+1] = temp;
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
temp = c[j];
c[j] = c[j+1];
c[j+1] = temp;
}
}
}
for(int i=0; i<n; i++)
{
cout<<c[i]<<' '<<a[i]<<' '<<b[i]<<'\n';
}
}
*/
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
void Swap(int arr[], int idx1, int idx2)
{
int temp = idx1;
idx1 = idx2;
idx2 = temp;
}
int partition(int arr[], int left, int right)
{
int p = arr[0];
int low = arr[1];
int high = arr[sizeof(arr)/sizeof(int)-1];
while(low > high)
{
if(low >= p)
{
Swap(arr,low,high);
}
else if(high <= p)
{
Swap(arr,high,low);
}
low++;
high--;
cout<<'*';
Swap(arr,high,low);
}
Swap(arr,high,p);
}
void Quicksort(int arr[], int left, int right)
{
for(int i=0; i<7; i++)
{
if(arr[left] > arr[right])
{
partition(arr,left+1,right);
}
left++;
right--;
}
}
int main(void)
{
int arr[7]={3,2,4,1,7,6,5};
//int arr[3]={3,3,3};
int len = sizeof(arr) / sizeof(int);
int i;
Quicksort(arr, 0, sizeof(arr)/sizeof(int)-1);
for(int i=0; i<len; i++)
cout<<arr[i]<<'\n';
}