#include <bits/stdc++.h>
using namespace std;
void smain();
int main() {
  ios::sync_with_stdio(false);
  smain();
  return 0;
}
const int MAXN = 64 + 3;
long long cnt[MAXN];
long long ori[MAXN];
long long out[MAXN];
void shink(int i) {
  ori[i] = ((ori[i] % cnt[i]) + cnt[i]) % cnt[i];
  out[i] = ((out[i] % cnt[i]) + cnt[i]) % cnt[i];
}
int GetNum(long long g) {
  int ans = 0;
  while (g) ans++, g >>= 1;
  return ans;
}
long long Renew(long long b, long long add) {
  int k = GetNum(b);
  add = (add % (1ll << k - 1) + (1ll << k - 1)) % (1ll << k - 1);
  return (b - (1ll << k - 1) + add) % (1ll << k - 1) + (1ll << k - 1);
}
void smain() {
  int M;
  cin >> M;
  long long d, Len;
  int op, n;
  cnt[0] = 1;
  for (int i = (1); i <= (MAXN - 1); ++i) cnt[i] = 2ll * cnt[i - 1];
  while (M--) {
    cin >> op >> d;
    if (op == 1 || op == 2) cin >> Len;
    n = GetNum(d);
    if (op == 1) {
      out[n] -= Len;
      shink(n);
    }
    if (op == 2) {
      ori[n] += Len;
      shink(n);
    }
    if (op == 3) {
      d = Renew(d, -out[n]);
      while (d) {
        cout << Renew(d, out[n]) << " ";
        d = Renew(d, ori[n]);
        d >>= 1, n--;
      }
      cout << endl;
    }
  }
}
