#include <iostream>
#include <cstdio>
using namespace std;
int main(int n)
{
for(scanf("%d",&n);(printf("%d\n",n))&&(n!=1);n=n&1?(n<<1)+n+1:n>>1) {}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oaW50IG4pIAp7Cglmb3Ioc2NhbmYoIiVkIiwmbik7KHByaW50ZigiJWRcbiIsbikpJiYobiE9MSk7bj1uJjE/KG48PDEpK24rMTpuPj4xKSB7fQoJcmV0dXJuIDA7Cn0=