#include<bits/stdc++.h>
using namespace std;
int ii;
void showlist(int a[],int len){
for(int i=0;i<len;i++){
cout<<a[i]<<" ";
}
cout<<endl;
}
void mergeadd(int a[],int left,int mid,int right,int *t){
int i=left;
int j=mid+1;
int k=left;
cout<<"add"<<endl;
while(i<=mid&&j<=right){
if(a[i]<a[j]){
t[k]=a[i];
i++;
k++;
}else{
t[k]=a[j];
j++;
k++;
}
}
cout<<"add2";
while(i<=mid){
t[k]=a[i];
k++;
i++;
}
while(j<=right){
t[k]=a[j];
k++;
j++;
}
cout<<"add3";
memcpy(a+left,t+left,sizeof(int)*(right-left+1));
}
void mergesort(int a[],int left,int right,int *t){
if(left<right){
int mid=left+(right-left)/2;
mergesort(a,left,mid,t);
mergesort(a,mid+1,right,t);
mergeadd(a,left,mid,right,t);
}
cout<<"sdf"<<endl;
}
int main(int argc, char** argv) {
int x;
freopen("in.txt","r",stdin);
int a[10];
while(cin>>x){
a[ii]=x;
ii++;
}
showlist(a,ii);
int *temp = (int*)malloc(sizeof(int)*ii);
mergesort(a,0,ii-1,temp);
showlist(a,ii);
return 0;
}