#include <bits/stdc++.h>
using namespace std;
template <class T>
void chkmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chkmin(T &a, T b) {
  if (a > b) a = b;
}
int q, t;
long long x, k, r[200010];
int f(long long a) {
  long long b = 2;
  int cnt = 0;
  while (b <= a) b <<= 1, cnt++;
  return cnt;
}
int main() {
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &t);
    if (t <= 2) {
      scanf("%I64d%I64d", &x, &k);
      int i = f(x);
      r[i] += k;
      r[i] %= 1ll << i;
      if (t == 1) {
        r[i + 1] -= 2 * k;
        r[i + 1] %= 1ll << (i + 1);
      }
    }
    if (t == 3) {
      scanf("%I64d", &x);
      int i = f(x);
      for (int j = i; j >= 0; j--) {
        printf("%I64d ", x);
        x = (x + r[j]) % (1ll << j) + (1ll << j);
        x >>= 1;
      }
      puts("");
    }
  }
  return 0;
}
