#include <iostream>
using namespace std;
int main(int argc, char **argv) {
void max_min_value(int n[],int size);
int a[10] = {9,6, 3, 8, 5, 1, 7, 10, 4, 2};

max_min_value(a,10);
for (int i = 0; i < 10; i++) {
cout<<a[i]<<" ";
}
}

void max_min_value(int n[],int size) {
int min,max,min_index,max_index;
for (int i = 0; i < size; i++) {
if(n[i]<min){
min=n[i];min_index=i;
}
}
n[min_index]=n[0];
n[0]=min;
int temp = n[9];
for (int i = 0; i < size; i++) {
cout<<n[i]<<" ";
int ind;
if(n[i]>max){
max=n[i];
ind=max_index=i;
}
}
n[max_index]=temp;
n[9]=max;
cout<<endl;
}