#include <bits/stdc++.h>
using namespace std;
const int IINF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int DX[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int DY[] = {0, 1, 0, -1, 1, -1, -1, 1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long sqr(long long x) { return x * x; }
long long sqr(int x) { return (long long)x * x; }
double sqr(double x) { return x * x; }
long double sqr(long double x) { return x * x; }
mt19937 mmtw(960172);
long long rnd(long long x, long long y) {
  static uniform_int_distribution<long long> d;
  return d(mmtw) % (y - x + 1) + x;
}
const int N = 61;
long long st[N];
long long sh[N];
int getLev(long long x) {
  for (int i = 0; i < N; ++i) {
    if (x >= st[i] && (i == N - 1 || x < st[i + 1])) return i;
  }
  assert(0);
}
int main() {
  st[0] = 1;
  for (int i = 1; i < N; ++i) st[i] = st[i - 1] * 2;
  int qq;
  scanf("%d", &qq);
  while (qq--) {
    int tt;
    scanf("%d", &tt);
    if (tt == 3) {
      long long x;
      scanf("%lld", &x);
      int lev = getLev(x);
      long long pos = (x - st[lev] + sh[lev]) & ((1LL << lev) - 1);
      cout << x;
      while (lev != 0) {
        pos /= 2;
        --lev;
        cout << " " << (st[lev] + ((pos - sh[lev]) & ((1LL << lev) - 1)));
      }
      cout << "\n";
    } else {
      long long x, k;
      scanf("%lld%lld", &x, &k);
      int lev = getLev(x);
      k &= ((1LL << lev) - 1);
      for (int i = lev; i < (tt == 1 ? lev + 1 : N); ++i) {
        (sh[i] += k) &= ((1LL << i) - 1);
        k *= 2;
      }
    }
  }
  return 0;
}
