#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, siz = 1e6 + 5;
long long q, n, m, a[siz], rot[66];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> q;
  while (q--) {
    long long op;
    cin >> op;
    if (op <= 2) {
      long long node, k;
      cin >> node >> k;
      long long dep = log2l(node);
      long long sz = 1LL << dep;
      if (k >= 0)
        k %= sz;
      else {
        k = sz + k;
        k %= sz;
      }
      rot[dep] += k;
      rot[dep] %= sz;
      if (op == 2) {
        long long incr = 2 * k;
        for (long long i = dep + 1; i <= 60; i++) {
          rot[i] += incr;
          rot[i] %= (1LL << i);
          incr *= 2;
        }
      }
      continue;
    }
    long long node;
    cin >> node;
    long long dep = log2l(node);
    long long pos_start = node - (1LL << dep);
    long long pos = (rot[dep] + pos_start) % (1LL << dep);
    vector<long long> out;
    while (dep > 0) {
      long long nxt = pos;
      long long incr = (1LL << dep) - rot[dep];
      long long new_pos = (pos + incr) % (1LL << dep);
      long long inp = (1LL << dep) + new_pos;
      out.push_back(inp);
      pos = nxt + (1LL << dep);
      pos /= 2;
      dep--;
    }
    out.push_back(1);
    for (auto x : out) cout << x << " ";
    cout << endl;
  }
}
