#include <bits/stdc++.h>
using namespace std;
const int PMAX = 61;
long long shift[PMAX];
inline int logbin(long long x) { return 63 - __builtin_clzll(x); }
inline void modif(int p, long long k) {
  shift[p] += k;
  shift[p] %= (1ll << p);
}
int main() {
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      long long x, k;
      scanf("%I64d%I64d", &x, &k);
      int p = logbin(x);
      k = ((k % (1ll << p)) + (1ll << p)) % (1ll << p);
      modif(p, k);
    } else if (t == 2) {
      long long x, k;
      scanf("%I64d%I64d", &x, &k);
      int p = logbin(x);
      k = ((k % (1ll << p)) + (1ll << p)) % (1ll << p);
      for (int i = p; i < PMAX; i++, k *= 2) modif(i, k);
    } else {
      long long x;
      scanf("%I64d", &x);
      for (int p = logbin(x); p >= 0; p--) {
        printf("%lld ", x);
        x = (1ll << p) + (x + shift[p] + (1ll << p)) % (1ll << p);
        x /= 2;
        if (p > 0)
          x = (1ll << (p - 1)) +
              (x - shift[p - 1] + (1ll << (p - 1))) % (1ll << (p - 1));
      }
      printf("\n");
    }
  }
}
