#include<bits/stdc++.h> using namespace std; int main(){ int a[200],n=0; while(true){ cin>>a[++n]; if(a[n]==0) break; } n--; for(int i=n;i>=1;i--) cout<<a[i]<<" "; return 0; }