#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; stack<int> s; while(n>1){ s.push(n); if(n&1){ n = n*3+1; }else{ n = n>>1; } } s.push(1); while(!s.empty()){ cout<<s.top()<<" "; s.pop(); } return 0; }