#include <bits/stdc++.h>
using namespace std;
const int64_t logn = 61;
int64_t level(int64_t x) {
  int64_t ans = 0;
  while (x) {
    x /= 2;
    ans++;
  }
  return ans;
}
int64_t sva[logn], sve[logn];
void shift_val(int64_t lvl, int64_t k) {
  sva[lvl - 1] += k;
  sva[lvl - 1] %= 1LL << logn;
}
void shift_ver(int64_t lvl, int64_t k) {
  sve[lvl - 1] += k;
  sve[lvl - 1] %= 1LL << logn;
}
void normalize(int64_t &x, int64_t t) {
  x %= (1LL << t);
  if (x < 0) {
    x += 1LL << t;
  }
  x += 1LL << t;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int64_t q;
  cin >> q;
  while (q--) {
    int64_t t, x;
    cin >> t >> x;
    if (t == 3) {
      vector<int64_t> ans;
      for (int64_t i = logn - 1; i >= 0; i--) {
        if (level(x) > i) {
          ans.push_back(x);
          x += sva[i];
          x += sve[i];
          normalize(x, i);
          x /= 2;
          if (i) {
            x -= sva[i - 1];
            normalize(x, i - 1);
          }
        }
      }
      for (auto it : ans) {
        cout << it << ' ';
      }
      cout << endl;
    } else {
      int64_t k;
      cin >> k;
      if (t == 1) {
        shift_val(level(x), k);
      } else {
        shift_ver(level(x), k);
      }
    }
  }
  return 0;
}
