#include <bits/stdc++.h>
using namespace std;
//퀵정렬 : 내림차순
void quick(int data[], int left, int right){
int num, i, j, temp;
if(right > left){
num = data[right];
i = left - 1;
j = right;
for(;;){
while(data[++i] > num);
while(data[--j] < num);
if(i >= j)
break;
swap(data[i], data[j]);
}
swap(data[i], data[right]);
quick(data, left, i-1);
quick(data, i+1, right);
}
}
int main() {
int a[10] = {2,3,4,0,9,8,7,6,5,1};
for(auto x : a){
printf("%d ", x);
}
puts("\n");
quick(a, 0, 9);
for(auto x : a){
printf("%d ", x);
}
return 0;
}