#include <bits/stdc++.h>
using namespace std;
const int maxn = 70;
long long value[maxn], mod[maxn];
int q;
int getDepth(long long x) {
  long long base = 1;
  int depth = 1;
  while (base <= x) base *= 2LL, depth++;
  return depth - 1;
}
int main() {
  scanf("%d", &q);
  long long base = 1;
  for (int i = 0; i < maxn; i++) mod[i] = base / 2, base *= 2LL;
  while (q--) {
    int type;
    long long x, k;
    scanf("%d%lld", &type, &x);
    x--;
    if (type == 1 || type == 2) {
      scanf("%lld", &k);
      int depth = getDepth(x + 1);
      long long Mod = mod[depth];
      if (type == 1) {
        k %= Mod;
        if (k < 0) k += Mod;
        value[depth] = (value[depth] + k) % Mod;
        if (value[depth] < 0) value[depth] += Mod;
      } else {
        k %= Mod;
        if (k < 0) k += Mod;
        for (int i = depth; i <= 60; i++) {
          Mod = mod[i];
          value[i] = (value[i] + k) % Mod;
          if (value[i] < 0) value[i] += Mod;
          k *= 2LL;
        }
      }
    } else {
      if (x == 0) {
        puts("1");
        continue;
      }
      printf("%lld ", x + 1);
      int depth = getDepth(x + 1);
      long long Mod = mod[depth], st = Mod - 1, origin = x - st;
      x = ((st + (origin + value[depth]) % Mod) - 1) / 2;
      while (x != 0) {
        int depth = getDepth(x + 1);
        long long Mod = mod[depth], st = Mod - 1, origin = x - st;
        printf("%lld ", st + (origin - value[depth] + Mod) % Mod + 1);
        x = (x - 1) / 2;
      }
      puts("1");
    }
  }
  return 0;
}
