#include <bits/stdc++.h>
using namespace std;
inline void splay(long long &v) {
  v = 0;
  char c = 0;
  int p = 1;
  while (c < '0' || c > '9') {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    v = (v << 3) + (v << 1) + c - '0';
    c = getchar();
  }
  v *= p;
}
int Q;
long long v[66], a[66];
int main() {
  cin >> Q;
  v[0] = 1;
  for (int i = 1; i <= 60; i++) {
    v[i] = v[i - 1] * 2;
  }
  for (; Q--;) {
    long long id, x, k;
    splay(id);
    if (id == 1) {
      splay(x), splay(k);
      int tot = -1;
      for (long long i = x; i; i >>= 1) tot++;
      k = (k % v[tot] + v[tot]) % v[tot];
      a[tot] += k;
      a[tot] = (a[tot] % v[tot] + v[tot]) % v[tot];
    } else if (id == 2) {
      splay(x), splay(k);
      int tot = -1;
      for (long long i = x; i; i >>= 1) tot++;
      k = (k % v[tot] + v[tot]) % v[tot];
      for (int i = tot; i <= 60; i++) {
        a[i] += k;
        k <<= 1;
        a[i] = (a[i] % v[i] + v[i]) % v[i];
      }
    } else if (id == 3) {
      splay(x);
      int tot = -1;
      for (long long i = x; i; i >>= 1) tot++;
      x += a[tot];
      if (x >= v[tot] * 2) x -= v[tot];
      for (; x; x >>= 1, tot--) {
        long long ans = x - a[tot];
        if (ans < v[tot]) ans += v[tot];
        printf("%I64d ", ans);
      }
      puts("");
    }
  }
}
