#include<bits/stdc++.h>
using namespace std;
int main(){
int c;
cin>>c;
int number[110];
int size=0;
while(c!=0){
number[size++]=c;
cin>>c;
}
for(int i=size-1;i>=0;i--){
cout<<number[i]<<" ";
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
int c;
cin>>c;
int number[110];
int size=0;
while(c!=0){
number[size++]=c;
cin>>c;
}
for(int i=size-1;i>=0;i--){
cout<<number[i]<<" ";
}
return 0;
}