#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
using namespace std;
void binary(int first, int end, int target)
{
if (first > end)
return;
int mid = (first + end) / 2;
cout << mid << " ";
if (mid == target)
return;
if (mid < target)
binary(mid + 1, end, target);
else
binary(first, mid - 1, target);
}
int main()
{
int target[50];
int i;
for (i = 0; i < 50; i++)
{
cin >> target[i];
if (target[i] == 0)
break;
}
for (int j = 0; j < i; j++)
{
binary(1, 50, target[j]);
cout << "\n";
}
return 0;
}