#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int n = 0,i=0,count = 0;
scanf("%d", &n);
int a[101];
a[0] = n;
int x = n;
for (i = 1;; i++)
{
if (x % 2 != 0)
{
a[i] = x * 3 + 1;
x = a[i];
}
else
{
a[i] =x / 2;
x = a[i];
}
if (x == 1)
{
a[i] = x;
break;
}
count++;
}
for (i = count+1; i >= 0; i--)
{
printf("%d ", a[i]);
}
}