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