#include <bits/stdc++.h>
using namespace std;
const int N = 61;
long long sh[N], sz[N], f[N];
int find(long long x) {
  int l = 1, r = N - 1, mid;
  while (l < r) {
    mid = (l + r + 1) / 2;
    if (f[mid] <= x)
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
void go(int lev, long long x) {
  long long g = x - f[lev] + sh[lev] + sz[lev];
  g = (g + sz[lev]) % sz[lev];
  g += f[lev];
  while (lev) {
    x = (g + sz[lev] - sh[lev]) % sz[lev];
    x += f[lev];
    printf("%lld ", x);
    g >>= 1;
    --lev;
  }
  putchar('\n');
}
int main() {
  sz[1] = 1, f[1] = 1;
  for (int i = 2; i < N; ++i) {
    sz[i] = sz[i - 1] * 2;
    f[i] = f[i - 1] * 2;
  }
  int Q;
  scanf("%d", &Q);
  int type, lev;
  long long X, K;
  int i;
  while (Q--) {
    scanf("%d%lld", &type, &X);
    lev = find(X);
    if (type == 1) {
      scanf("%lld", &K);
      K %= sz[lev];
      K = (K + sz[lev]) % sz[lev];
      sh[lev] = (sh[lev] + K) % sz[lev];
    } else if (type == 2) {
      scanf("%lld", &K);
      for (i = lev; i < N; ++i) {
        K %= sz[i];
        K = (K + sz[i]) % sz[i];
        sh[i] = (sh[i] + K) % sz[i];
        K <<= 1;
      }
    } else {
      assert(type == 3);
      assert(lev > 0);
      go(lev, X);
    }
  }
  return 0;
}
