#include<bits/stdc++.h> #define int long long using namespace std; stack<int> st; signed main() { int y; while(y!=0) { cin>>y; st.push(y); } st.pop(); while(!st.empty()) { cout<<st.top()<<" "; st.pop(); } return 0; }