#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int a[N];
int main() {
int idx;
//数字0时终止输入
for (idx = 0;; idx++) {
cin >> a[idx];
if (a[idx]==0) {
//最后一个a[i]是零啊!为啥是i-1,因为在上面的循环中,最后一次i++了。
idx--;
break;
}
}
for (int j = idx; j >= 0; j--) cout << a[j] << " ";
return 0;
}