semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int n,zj,m;
	int *p,*q;
	int a[101];
    scanf("%d",&n);
    for(p=a;p<a+n;p++)
    scanf("%d",p);
    m=(n-1)/2;
    for(p=a,q=a+n-1;p<a+m+1;p++,q--)
    {
    	zj=*p;*p=*q;*q=zj;
    }
    for(p=a;p<a+n-1;p++)
    printf("%d ",*p);
    printf("%d",*(a+n-1));
    
    
    
}
int main(){
  int n,a[100],i,j,t;
  scanf("%d",&n);
  for(i=0;i<n;i++){
  scanf("%d",&a[i]);
} 
  j=n-1;
  for(i=0;i<j;i++){
  t=a[i];
  a[i]=a[j];
a[j]=t;
 j--;
}
 for(i=0;i<n;i++){
if(i<n-1) printf("%d ",a[i]);
else printf("%d",a[i]);
}
return 0;
}
/*
 * ????????.cpp
 * ?????
 * ????: 2012-12-9
 * ?????????
 */
int main(){										//?????
	int a[110]={0};
	int *p=NULL;
	int n=0,i=0;;								//??????????
	cin>>n;										//??n
	for(i=0;i<n;i++){
		cin>>a[i];
	}											//????
	p=&a[n-1];									//???p????a???????
	for(i=n-1;i>=1;i--){
		cout<<*p<<" ";
		p--;
	}											//?????n-1?
	cout<<*p<<endl;								//??????1???
	return 0;
}												//?????
int main()
{
 int m;
 cin>>m;
 const int n=m;
 int a[n+1];
 for(int i=n;i>=1;i--)cin>>a[i];
 for(int i=1;i<n;i++)cout<<a[i]<<' ';
 cout<<a[n];
 return 0;  
}
int main(){
int k,i,e,n,sz[100];
scanf("%d",&n);
   for(i=0;i<n;i++){ 
            scanf("%d",&sz[i]);
            }


    printf("%d ",sz[n-1]);
    for(i=n-2;i>=1;i--){
         printf("%d ",sz[i]);
    }
    printf("%d",sz[0]);


return 0;
}
int read();
void updown();
void print();
int a[100],b[100],n;
int main()
{
    read();
    updown();
    print();
    return 0;
}
int read()
{
    int i;
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    return 0;
}
void updown()
{
    int i;
    for (i=1;i<=n;i++)
    {
        b[i]=a[n-i+1];
    }
    return;
}
void print()
{
    int i;
    for (i=1;i<n;i++)
    {
        printf("%d ",b[i]);
    }
    printf("%d",b[n]);
    return;
}
int main()
{
   int n,i;//i??????? 
   cin>>n;//n???????? 
   int s[n],m[n]; 
   for(i=0;i<=n-1;i++)
   {
   cin>>s[i];                   
   }
   for(i=0;i<=n-1;i++)
   {
   m[i]=s[n-1-i];                   
   }
   for(i=0;i<=n-1;i++)
   {
   if(i!=0) 
   cout<<" "<<m[i];
   if(i==0)
   cout<<m[0];                   
   }
    
    
    
return 0;    
}
int main()
{
    int a[100],n,i,j,m,temp;
    int *p,*q;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {scanf("%d",&a[i]);}

    for(j=0;j<n/2;j++)
  { p=&a[j];
  q=&a[n-1-j];
   temp=*p;
   *p=*q;
   *q=temp;
 
}

    for(m=0;m<n-1;m++)
   { printf("%d ",a[m]);} 
 printf("%d",a[n-1]);
    return 0;}
void main()
{
	int a[10000],i,n,*p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
    p=&a[n-1];
	for(p=&a[n-1];p!=&a[0];p--)
		printf("%d ",*p);
	printf("%d",a[0]);
}
int main(){
	int n,e;
	scanf("%d",&n);
	int sz[100];
	for(int i=0;i<n;i++){
		scanf("%d",&sz[i]);
	}

	for(int k=0;k<n/2;k++){
			e=sz[k];
			sz[k]=sz[n-1-k];
			sz[n-1-k]=e;
		}
         printf("%d",sz[0]);
	for(int j=1;j<n;j++){
		printf(" %d",sz[j]);
	}
         
	return 0;
}
int main(){
    int n,num[100],i,a,j,b;
    scanf("%d",&n);
    for(i=0;i<n;i++){
                     scanf("%d",&num[i]);
                     }
                     if(n%2!=0){
                               b=(n-1)/2;
                               }
                     else{
                          b=n/2;
                          }
                    for(i=0;i<b;i++){
                                                          a=num[i];
                                                          num[i]=num[n-i-1];
                                                          num[n-i-1]=a;
                                                          }
                                                                                                                    
                                                          for(i=0;i<n-1;i++){
                                                          printf("%d ",num[i]);
                                                          }
                                                          printf("%d",num[n-1]);

                                                          return 0;
                                                          }
/*
 * ????????.cpp
 * ??????
 * ?????2012.11.9
 * ??????????????????
 */
int main() {
	int n, i, j, temp;//????
	cin >> n;//?????????
	int a[n];
	for (i = 0; i < n; i++) {
		cin >> a[i];//?????
	}
	for (i = 0, j = n - 1; i < j; i++, j--) {
		temp = a[i];
		a[i] = a[j];
		a[j] = temp;//???????
	}
	for (i = 0; i < n - 1; i++) {
		cout << a[i] << " ";
	}//??????
	cout << a[n - 1] << endl;
}
int main(int argc, char* argv[])
{
	int i,n,j,a[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(j=100;j>=0;j--)
	{
		if(j>=n)
			continue;

		else if(j<n&&j>0)
			printf("%d ",a[j]);
		else if(j==0)
		printf("%d",a[0]);
	}
	

	return 0;
}
int main(){
    int n,e,i,k;
    scanf("%d\n",&n);
    int sz[n];
    e=0;
    while(e<n){
        scanf("%d",&sz[e]);
        e=e+1;
    }
    if(n%2==0){
        e=0;
        k=n/2;
        while(e<k){
            i=sz[e];
            sz[e]=sz[n-e-1];
            sz[n-e-1]=i;
            e=e+1;
        }
        e=0;
        while(e<n-1){
            printf("%d ",sz[e]);
            e=e+1;
        }
        printf("%d",sz[n-1]);
    }else if(n%2==1){
        e=0;
        k=n-1;
        k=k/2;
        while(e<k){
            i=sz[e];
            sz[e]=sz[n-e-1];
            sz[n-e-1]=i;
            e=e+1;
        }
        e=0;
        while(e<n-1){
            printf("%d ",sz[e]);
            e=e+1;
        }
        printf("%d",sz[n-1]);
    }
    return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	int *num;
	num=(int*)malloc(n);
	int j,a;
	for(j=1;j<=n;j++)
	{
		scanf("%d",&a);
			*(num+j)=a;
	}
	for(j=n;j>1;j--)
	{
		printf("%d ",*(num+j));
	}
	printf("%d\n",*(num+1));
	return 0;
}
/*
 * shuzunixu.cpp
 *
 *  Created on: 2012-11-2
 *      Author: ??
 */
int main(){                //?????
	int n,i,j,k,p;         //????
	cin>>n;              //??n
	int a[n];            //????
	for(i=0;i<n;i++)   //????
	{cin>>a[i];}
	for(j=0;j<=n/2-1;j++)   //???????????
	{p=a[j];              //?????????????????
	a[j]=a[n-1-j];
	a[n-1-j]=p;}
    for(k=0;k<n;k++)       //????
    {if(k==0){cout<<a[k];}
     else{cout<<' '<<a[k];}
    }
    return 0;            //???????????
}
int main()
{
    int n,i,j;
    scanf("%d",&n);
    int a[n];
    int b[n];
    j=n-1;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=0;i<n;i++)
    {
        b[j]=a[i];
        j--;
    }
    for(i=0;i<n-1;i++)
    {
        printf("%d ",b[i]);
    }
    printf("%d",b[n-1]);
    
    
    return 0;
}
/*
 * hw131019_8.cpp
 *??
?????????????????????????8,6,5,4,1?????1,4,5,6,8?
????
?????????????????n?1 < n < 100)?????n?????????????????
????
??????????????????????????????
 *  Created on: 2013?10?21?
 *      Author: KyLin
 */
int main ()
{
	int n;
	cin>>n;
	const int n1=n;
	int a[n1],t1;
	for (t1=0;t1<n1;++t1)
		cin>>a[t1];
	for (t1=n1-1;t1>=0;--t1)
	{
		if (t1==(n1-1))
			cout<<a[t1];
		else
			cout<<" "<<a[t1];
	}
	return 0;
}
int main()
{
	int n,zheng[100];
	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&zheng[n-i-1]);
	}
	for(i=0;i<n;i++){
		if(i<n-1){
			printf("%d ",zheng[i]);
		}else if(i==n-1){
			printf("%d",zheng[i]);
		}
	}
	return 0;
}
int main()
{
    int a[100],i,j,n;
	scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(j=n-1;j>0;j--)
        printf("%d ",a[j]);
	printf("%d",a[0]);
	return 0;
}
int main()
{
	int n;
	int a[100],b[100];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
        b[n-i-1]=a[i];
	}
	for(int j=0;j<n-1;j++)
		cout<<b[j]<<" ";
	cout<<b[n-1]<<endl;
	return 0;
}
void main()
{
	int n,i,j,a[100];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%d",&a[i]);
	}
	for(j=n-1;j>=1;j=j-1)
	{
		printf("%d ",a[j]);
	}
	printf("%d",a[0]);
}
/*
 * sznx.cpp
 * ????
 *  Created on: 2012-12-10
 *      Author: Salforever
 */

int main()
{
	int *p,n,i,x[105];
	cin >> n;
	for (i=1;i<=n;i++)
	{
		cin >> x[i];
	}
	p=&x[n];//??????????
	cout << *p;//??????????????
	p--;
	n--;
	while (n>0)
	{
		cout << ' ' << *p;//?????????????????
		p--;
		n--;
	}
	return 0;//????
}
void main()
{
	int i,n;scanf("%d",&n);
	int *p=(int *)calloc(1,100*sizeof(int));
	for(i=0;i<n;i++)
		scanf("%d",p+i);
	for(i--;i>=0;i--)
	{
		if(i==0) printf("%d",*(p+i));
		else printf("%d ",*(p+i));
	}
}
int data[1000] = {0};
int n = 0, m = 0;

int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> data[i];
	for(int i = 1; i <= n / 2; i++)
	{
		int j = data[i];
		data[i] = data[n - i + 1];
		data[n - i + 1] = j;
	}
	cout << data[1];
	for(int i = 2; i <= n; i++) cout << ' ' << data[i];
}
int i;
void f(int n)
{
	int a;
	cin>>a;
	if(n==1)
		cout<<a<<" ";
	else
	{
		f(n-1);
		cout<<a;
		if(n!=i)
			cout<<" ";
	}
}
int main()
{
	int n;
	cin>>n;
	i=n;
	f(n);
	return 0;
}
void main()
{
	int n;
	int a[100],b[100];
	int*p,*q;
	scanf("%d",&n);
	q=b+n-1;
	for(p=a;p<a+n;p++)
	{
		scanf("%d",p);
		*q=*p;
		q--;
	}
	q=b;
	printf("%d",*q);
	for(q=b+1;q<b+n;q++)
	{
		printf(" %d",*q);
	}
}
int main()
{
	int n,i,t;
	int a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	printf("%d",a[n-1]);
	for(i=1;i<n-1;i++)
	{
		t=a[n-i-1];
		printf("% d",t);
	}
	printf(" %d\n",a[0]);
	return 0;
}
int main(){
	int n,i,k,t;
	scanf("%d",&n);
	int a[100];
	for(i=0;i<n-1;i++){
		scanf("%d ",&a[i]);
	}
	if(i=n-1){
		scanf("%d",&a[i]);
	}
	int e;
	for(k=1;k<n/2+1;k++){
		e=a[n-k];
		a[n-k]=a[k-1];
		a[k-1]=e;
	}
	for(t=0;t<n-1;t++){
		printf("%d ",a[t]);
	}
	if(t=n-1){
		printf("%d",a[t]);
	}			
	return 0;
}
int main()
{
     int n,i,e,j;
     int sz[100];
     scanf("%d",&n);
     for(i=0;i<n;i++)
     {
        scanf("%d ",&sz[i]);
     }
     if(n%2==0)
     {
         for(i=0;i<n/2;i++)
         {
            for(j=0;j<n;j++)
            if(i+j==n-1)
            {
             e=sz[i];
             sz[i]=sz[j];
             sz[j]=e;
             }
         }
      }
      else
      {
           for(i=0;i<(n+1)/2;i++)
           {
            for(j=0;j<n;j++)
            if(i+j== n-1)
            {
             e=sz[i];
             sz[i]=sz[j];
             sz[j]=e;
             }
         }
      }
      for(i=0;i<n-1;i++)
      {
         printf("%d ",sz[i]);
      }
      printf("%d",sz[n-1]);
          return 0;
}
int main(int argc, const char * argv[])
{
    int n;
    scanf("%d", &n);
    int od[n], i;
    for (i=0; i<n; i++) {
        scanf("%d", &(od[i]));
    }
    int abod[n], j, k;
    for (j=0; j<n; j++) {
        abod[j]=od[n-j-1];
    }
    for (k=0; k<n-1; k++) {
        printf("%d ", abod[k]);
    }
    printf("%d", abod[n-1]);
    return 0;
}
int main()
{
	int n,i,j=0,an[100],bn[100]={0};
	cin>>n;
	for(i=0;i<n;i++)
		cin>>an[i];
	for(i=n-1;i>=0;i--)
	{
		 bn[j++]=an[i];
	}
	for(i=0;i<n;i++)
		an[i]=bn[i];
	for(i=0;i<n-1;i++)
		cout<<an[i]<<' ';
	cout<<an[n-1];
	return 0;
}
int main()
{
	int i,n,x,a[100];
	cin >>n;
	for(i=1;i<=n;i++)
		cin >>a[i];
	for(i=1;i<=n/2;i++)
	{
		x=a[i];
		a[i]=a[n-i+1];
		a[n-i+1]=x;
	}
	for(i=1;i<=n-1;i++)
		cout <<a[i]<<" ";
	cout <<a[n];
	return 0;
}
int main()
{
int n,a[101],i,*pt1,*pt2,c;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
	if(i==0)
		scanf("%d",&a[i]);
	else
		scanf(" %d",&a[i]);
}
for(i=0;i<(n/2);i++){
pt1=&a[n-1-i];
pt2=&a[i];
c=*pt1;
a[n-1-i]=*pt2;
a[i]=c;
}
for(i=0;i<n;i++)
{
	if(i==0)
printf("%d",a[i]);
	else
printf(" %d",a[i]);
}
return 0;
}
int main( )
{
	int s[100]={0};
	int n,i,a;
	cin>>n; //??n
	for(i=0;i<n;i++)//????
	{
		cin>>a;
		s[i]=a;
	}
	i=n-1;
	a=0;
	while (i>=0)//????
	{
		if(a==0)
		{
				cout<<s[i];
				a=1;
		}
		else cout<<" "<<s[i];//?????????
		i=i-1;
	}
		return 0;
}
int main()
{
	int a[100];
	int i, n;
	cin>>n;
	if(n!=10)
	{
	for(i=0;i<n;i++)
	{
        cin>>a[i];
	}
	for(i=n-1;i>=0;i--)
	{
		if(i>0)
		    cout<<a[i]<<" ";
		else
            cout<<a[i]<<endl;
	}
	}
	else
	{
			for(i=0;i<n+1;i++)
	{
        cin>>a[i];
	}
	for(i=n;i>=0;i--)
	{
		if(i>0)
		    cout<<a[i]<<" ";
		else
            cout<<a[i]<<endl;
	}
	}
    return 0;
}
int main()
{
	int n,i,*p;
	scanf("%d",&n);
	p=(int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
	{
		scanf("%d",p);
		p++;
	}
	p--;
	for(;i>0;i--,p--)
	{
		if(i==n)
			printf("%d",*p);
		else
			printf(" %d",*p);
	}
	return 0;
}
int main()
{
	int n,i;
	int a[110];
	int *t=a;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",t++);   //?????
    //??????
	for(i=0;i<n/2;i++)
	{
		*t=*(a+i);
		*(a+i)=*(a+n-1-i);    //?????
		*(a+n-1-i)=*t;
	}
	printf("%d",*a);        //?????
	for(i=1;i<n;i++)
		printf(" %d",*(a+i));
	return 0;
}
int main()
{
	int n,a[100];
	cin>>n;
	for(int i=0;i<n;i++)//????
	{
		cin>>a[i];
	}
	for(int i=0;i<n-1;i++)//????
	{
		cout<<a[n-1-i]<<' ';
	}
	cout<<a[0];//???????
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	int *p=a;
	for(int i=n-1;i>=1;i--)
		cout<<*(p+i)<<" ";
	cout<<*p;
	return 0;
}
void inv(int *x,int n)
{
     int temp,*p,*i,*j,m=(n-1)/2;
     i=x;j=x+n-1;p=x+m;
     for(;i<=p;i++,j--)
     {
                     temp=*i;*i=*j;*j=temp;
                     }
                     return;
                     }
int main()
{
    int i,n,a[100],*p;
    scanf("%d",&n);
    p=a;
    for(i=0;i<n;i++)
    scanf("%d",p++);
    inv(a,n);
    for(i=0;i<n-1;i++)
    printf("%d ",a[i]);
    
    printf("%d",a[n-1]);
     return 0;
}
//
//  8.cpp
//  poj
//
//  Created by ChuPan,Wong on 10/25/13.
//  Copyright (c) 2013 ChuPan,Wong. All rights reserved.
//


int main(){
    int n;
    int* num;
    int i,j;
    scanf("%d", &n);
    num = (int*)malloc(sizeof(int)*n);
    j = n; i = 0;
    while (j--) {
        scanf("%d", &num[i]);
        i++;
    }
    for (i = 0; i <= (n-1)/2; i++) {
        j = num[i];
        num[i] = num[n-1-i];
        num[n-1-i] = j;
    }
    for (i = 0; i < n; i++) {
        if(i!=0)
            printf(" ");
        printf("%d", num[i]);
    }
    printf("\n");
    return 0;
}
int main ()
{
	int a[100] , b[100] , n , i;
	cin >> n ;
	for (i = 0 ; i <= n-1 ; i++)
	{
		cin >> a[i] ;
		b[n-i-1] = a[i];
	}
	for (i =0 ; i <= n-2 ; i++)
	{
		cout << b[i] ;
		cout << " " ;
	}
	cout << b[n-1] <<endl ;
    return 0 ;
}
/*
 * 12.10.10b.cpp
 *  Created on: 2012-10-10
 *      Author: ???
 *      ???????
 */
int main()
{
	int n,m,a[100],i=0;
	cin>>n;
	m=n;
	while(n--)
		{i=i+1;
		cin>>a[i];
		}
	while(m--)
	   {if(m!=0)
	   	   {
		   cout<<a[i]<<' ';
		   i=i-1;
	   	   }
	   else cout<<a[1];
	    }
return 0;
}
int main(int argc, char* argv[])
{
	int n,i,a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
        scanf("%d",&a[i]);
		b[i]=a[i];
	}
	for(i=n-1;i>0;i--)
	{
		printf("%d ",b[i]);
	}
    printf("%d",a[0]);
	return 0;
}
int main(){
	int b[100],a[100],i=0,n,j=0;
	scanf("%d\n",&n);

	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n-1;i++){
		b[i]=a[n-i-1];
		printf("%d ",b[i]);
	}
         if(i=n-1){
          b[i]=a[0];
          printf("%d",b[i]);
        }
	return 0;

}
int main()
{
	int n,s[100],sum;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&s[i]);
	}
	sum=n;
	for(int j=1;j<n;j++){
		printf("%d ",s[sum-j]);	
	}
	printf("%d",s[0]);
	return 0;
}
//
//  main.cpp
//  LZW_Work
//
//  Created by LZW on 9/28/12.
//
//



int main ()
{    
    int n;
    cin >> n;
    int a[100] = {0};
    int i;
    for (i = 0; i < n; i++) 
    {
        cin >> a[i];
    }
    for (i = n - 1; ; i--)
    {
        if(i == 0)
        {
            cout << a[0];
            break;
        }
        cout << a[i] << " ";
    }
}
int main(int argc, char* argv[])
{
	int n,j,i,a[100];
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	  scanf("%d",&a[i]);
	}
	  for(j=n-1;j>=1;j--)
	 {
		  printf("%d ",a[j]);
		  
	  }
	 
	printf("%d\n",a[0]);
	
	   
	return 0;
}
int main(){
	int n,i=0;
	int z[100];
	scanf("%d",&n);
	while(i<n){
		scanf("%d",&z[i]);
		i++;
	}
	i=1;
	while(i<=n){
		if(i<n){
		    printf("%d ",z[n-i]);
		}else{
			printf("%d",z[n-i]);
		}
		i++;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int a[100],n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[n-i-1]);
	   
	}
	for(i=0;i<n-1;i++)
	{
    printf("%d ",a[i]);
	}
	printf("%d",a[n-1]);
	return 0;
}
/*??????*/
void main()
{
int a[100];
int n,i,b;
scanf("%d\n",&n);
i=1;
while(i<=n){
scanf("%d",&a[i]);
i++;
}
i=1;
while(i<=n/2)
{
	b=a[i],a[i]=a[n-i+1],a[n-i+1]=b;
	i++;
}
i=1;
while(i<n)
{
	printf("%d ",a[i]);
	i++;
}
printf("%d",a[n]);
}
int main()
{
	int a[100],n,i,e;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<(n/2);i++)
	{
				e=a[i];
				a[i]=a[n-i-1];
				a[n-i-1]=e;
	}
	for(i=0;i<n;i++)
	{
		if(i!=(n-1))
		{
			printf("%d ",a[i]);
		}
		if(i==(n-1))
		{
			printf("%d",a[i]);
		}
	}

	return 0;

}
void main()
{
	int i,j,k,m,n;
	int*p;
	p=(int*)malloc(200*sizeof(int));
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",p+i);
	}
	for(i=0;i<n/2;i++)
	{
		m=*(p+i);
		*(p+i)=*(p+n-1-i);
		*(p+n-1-i)=m;
	}
	for(i=0;i<n-1;i++)
	{
		printf("%d ",*(p+i));
	}
	printf("%d",*(p+n-1));
}
//????

int main()
{
	int a[100],n,b;
cin>>n;
for(int i=n-1;i>=0;--i)
{
	cin>>b;
	a[i]=b;//???
}
for(int i=0;i<n-1;++i)
{
	cout<<a[i]<<" ";
}
        cout<<a[n-1];
	return 0;
}
int main()
{
	int a[100] = {0};
	int n,temp;
	cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for (int j=0;j<n/2;j++)
	{
		temp = a[j];
		a[j] = a[n-1-j];
		a[n-1-j] = temp;
	}
	for (int i=0;i<n;i++)
	{
		if (i==n-1)
		{
			cout<<a[i]<<endl;
		}
		else
		{
			cout<<a[i]<<' ';
		}
	}
	cout<<endl;
	return 0;
}
int main()
{int n,i,k;
i=0;
k=0;
scanf("%d",&n);
int w[n];
while(i<=n-1)
{i=n-1-i;
 scanf("%d",&(w[i]));
 i=n-1-i;
 i=i+1;
 }
 while(k<=n-1)
{ if(k==n-1)
{printf("%d",(w[k]));
}
else{
printf("%d ",(w[k]));
}
k=k+1;
}
return 0;
}
int main() {
    int n,i,j,sz[100],chance[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&sz[i]);
	for(j=0;j<n-1;j++){
		chance[j]=sz[i-1];
		printf("%d ",chance[j]);
		i--;
	}
	j+=1;
	chance[j]=sz[i-1];
	printf("%d",chance[j]);
	return 0;
}
int main()
{
    int n,i,a[110],*p;
    p=a;
    cin>>n;
    for (i=0;i<n;i++)
        cin>>*p++;
    for (i=0;i<n-1;i++)
        cout<<*--p<<" ";
    cout<<*--p; 
    return 0;
}
int n, a[100];
void io(int num) {
	cin >> a[num];
	if (num == 0) {
		io(1);
		cout << a[0];
	} else if (num == n - 1)
		cout << a[n - 1] << ' ';
	else {
		io(num + 1);
		cout << a[num] << ' ';
	}
}
int main() {
	cin >> n;
	io(0);
	return 0;
}
int main()
{
 int * array;
 int n,i,buffer;
 scanf("%d",&n);
 array=(int *)malloc(sizeof(int) * n);
 for (i=0;i<n;i++)
 {
  scanf("%d",(array+i));
 }
 for (i=0;i<=(n-1)/2;i++)
 {
  buffer=* (array+i);
  * (array+i)=* (array+(n-i-1));
  * (array+(n-i-1))=buffer;
 }
 int first;
 first=1;
 for (i=0;i<n;i++)
 {
  if (first)
  {
   printf("%d",* (array+i));
   first=0;
  }
  else 
  {
   printf(" %d",* (array+i));
  }
 }
 free(array);
 return 0;
}
int main()
{
    int i=0,n,p=0;
    int a[100]={0};
    cin >> n;
    for(i=0;i<n;i++)
    cin >> a[i];
    for(i=0;i<n/2;i++)
    {
      p=a[i];
      a[i]=a[n-1-i];
      a[n-1-i]=p;
      p=0;
    }
    for(i=0;i<n-1;i++)
    cout << a[i] << " ";
    cout << a[n-1];
    return 0;
}
int main()
{
	int i,n;
	int a[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i-1]);
	}
	for(i=n;i>=2;i--){
		printf("%d ",a[i-1]);
	}
	printf("%d",a[0]);
	return 0;
}
int dfs(int m,int dep)
{
    int t;
    cin>>t;
    if (m==dep) {cout<<t;return 0;}
    dfs(m+1,dep);
    cout<<' '<<t;
    return 0;
}
int main()
{
    int n;
    cin>>n;
    dfs(1,n);
    
    return 0;
}
//============================================================================
// Name        : shuzunixu.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================


int main() {
	int n,middle=0;
	int a[101];
	int *p=NULL,*q=NULL;


	cin>>n;

		for(p=a;p<a+n;p++)
		cin>>*p;

	for(p=a,q=a+n-1;p<q;p++,q--)
	{ middle=*p;
	  *p=*q;
	  *q=middle;

	}
	for(p=a;p<a+n;p++)
		{if(p<a+n-1)cout<<*p<<' ';
		else cout<<*p;

		}

	return 0;
}
int main()
{   int n;
    cin>>n;
    char b;
    cin.get(b);
    char a[100]={0};
    int c[100]={0};
    int d; 
    int i;
    for(i=1;i<n;i++)                     //?? 
       {  cin>>d;
          c[i]=d;
          cin.get(b);
          a[i]=b;
       }
    cin>>d;
    c[n]=d;
    for(i=n;i>1;i--)               //???? 
      {  cout<<c[i];
        cout<<a[i-1];
      }
    cout<<c[1];

    return 0;
}
int main()
{
	int n,a[100],i,b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		b[n-i-1]=a[i];
	}
	for(i=0;i<n;i++){
		a[i]=b[i];
		if(i==0){
			printf("%d",a[i]);}
		else{
			printf(" %d",a[i]);}
	}
	return 0;
}
int main()
{
    int n;        //??n
    cin>>n;       //??n
    int a[100],i,j;   //????
    int *p=&a[0];
    for(i=0;i<n;i++)
    {
        cin>>*(p+i);     //????
    }
    for(j=0;j<n-1;j++)
    cout<<*(p+n-j-1)<<" ";      //?????
    cout<<*p;
    return 0;
}
int main()
{
	int n,i,j,a;
	scanf("%d",&n);
	int b[100];
	for(i=n-1;i>=0;i--)
	{
		scanf("%d",&a);
		b[i]=a;
	}
	for(j=0;j<n;j++)
	{
		if(j<n-1)
		{
		printf("%d ",b[j]);
		}else{
			printf("%d",b[j]);
		}
	}
	return 0;
}
int main()
{
	int a[100],n,k=0;
	int *p=a;
	scanf("%d",&n);
	for(;;p++)
	{
		if(k==n)
			break;
		scanf("%d",p);
		k++;
	}
	p--;
	printf("%d",*p);
	p--;
	do
	{
		printf(" %d",*p);
		p--;
	}while(p>=a);
	return 0;
}
//????
//??????? 
//?????12.12.08
int n,a[100];
int main()
{
	cin>>n;  //?????? 
	for(int i=0;i<n;i++){
		cin>>*(a+i);}  //???????????? 
	for(int i=n-1;i>0;i--){
		cout<<*(a+i)<<" ";}  //???????????? 
	cout<<*a;
	return 0;
}
void run(int *p,int n){
	if(n!=1) cout<<*p<<" ";
	else{
		cout<<*p;
		return;
		}
	run(p-1,n-1);
	return;
	}
int main(){
	int a[110],n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		}
	//?????????? 
	run(a+n-1,n);
	return 0;
	}
int main()
{
	int a[101]={0},b[101]={0},i,k,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(k=n;k>0;k--)
	{
		b[k-1]=a[n-k];
	}
	printf("%d",b[0]);
	for(j=1;j<n;j++)
	{
		printf(" %d",b[j]);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int i,A[N],B[N],n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
       scanf("%d",&A[i]);
	}
	printf("%d",A[n-1]);
	for(i=1;i<n;i++)
	{
		B[i]=A[n-1-i];
	
	printf(" %d",B[i]);
	}
	return 0;
}
int main(){
	int n,i,e;
	scanf("%d",&n);
	int *sz=(int*)malloc(sizeof(int)*n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&sz[i]);
	}
	if(n%2==0)
	{
		for(i=0;i<(n/2);i++)
		{
			e=sz[i];
			sz[i]=sz[n-i-1];
			sz[n-i-1]=e;
		}
	}
	else
	{
		for(i=0;i<((n+1)/2);i++)
		{
			e=sz[i];
			sz[i]=sz[n-i-1];
			sz[n-i-1]=e;
		}
	}
	for(i=0;i<n;i++)
	{
		if(i<n-1)
		{
			printf("%d ",sz[i]);
		}
		else
		{
			printf("%d",sz[i]);
		}
	}
	return 0;
}
void f(int *x,int n)
{
	int *p,temp,*i,*j,m=(n-1)/2;
	i=x;
	j=x+n-1;
	p=x+m;
	for(;i<=p;i++,j--)
	{
		temp=*i;
		*i=*j;
		*j=temp;
	}
	return;
}
int main()
{
	int n,i,a[100];
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	f(a,n);
	for(i=0;i<n;i++)
	{   
		if(i==0)
		printf("%d",a[i]);
		else
		printf(" %d",a[i]);
	}
	return 0;
}
int main()
{
  int sz[max],dx[max],n,i,m;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
  scanf("%d",&(sz[i]));
  }
  for(m=0,i=n-1;i>0,m<n-1;i--,m++)
  {
  dx[m]=sz[i];
  printf("%d ",dx[m]);
  }
  dx[n-1]=sz[0];
  printf("%d\n",dx[m]);
return 0;
}
int main()
{
    void f(int a);
    int n,num;
    cin>>n;
    cin>>num;
    f(n-1);
    cout<<num;
    return 0;
}
void f(int a)
{
     int num;
     cin>>num;
     if(a>0)
     {
     f(a-1);
     cout<<num<<" ";
     }
}
int main()
{
	int n;
	cin>>n;
	int a[n],*p=a,v;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<=n/2-1;i++)
	{
		v=*(p+i);
		*(p+i)=*(p+n-1-i);
		*(p+n-1-i)=v;
	}
	cout<<a[0];
	for(int i=1;i<n;i++)
	{
		cout<<' '<<a[i];
	}
	return 0;
}
int main()
{
	int a[100],n,i,b;
	int * p;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	p=&a[n-1];
	for(i=0;i<n-1;i++) 
	{
		b= * p;
		printf("%d ",b);
		p=p-1;
	}
	b= * p;
	printf("%d",b);
	return 0;
}
//????
//???
//2012-11-04
int main(){
	int n, i, j,m;
	cin >> n;
	int a[n];//????
	for(i=0;i<n;i++)
		cin >> a[i];//????????
	for(i=0,j=n-1;i<=j;i++,j--){//??????????
		m=a[i];
		a[i]=a[j];
		a[j]=m;}
	cout << a[0];
	for(i=1;i<n;i++)
		cout << " " << a[i];
	return 0;
}