#include <bits/stdc++.h>
constexpr int MAX_LVL = 63;
using namespace std;
using ll = long long;
int n;
ll off[MAX_LVL];
int get_lvl(ll x) {
  int ans = 0;
  while (x > 0) {
    ++ans;
    x >>= 1;
  }
  return ans - 1;
}
void shift(int lvl, ll k) {
  ll lvl_size = 1LL << lvl;
  k %= lvl_size;
  k = (k + lvl_size) % lvl_size;
  off[lvl] = (off[lvl] + k) % lvl_size;
}
ll snum(int lvl, ll start, ll amt) {
  ll lvl_size = 1LL << lvl;
  amt = (amt % lvl_size + lvl_size) % lvl_size;
  return lvl_size + (start + amt) % lvl_size;
}
int main() {
  scanf(" %d", &n);
  for (int i = 0; i < n; ++i) {
    int typ;
    scanf(" %d", &typ);
    if (typ == 1) {
      ll x, k;
      scanf(" %lld %lld", &x, &k);
      shift(get_lvl(x), k);
    } else if (typ == 2) {
      ll x, k;
      scanf(" %lld %lld", &x, &k);
      for (int lvl = get_lvl(x); lvl < MAX_LVL; ++lvl) {
        shift(lvl, k);
        k *= 2;
      }
    } else if (typ == 3) {
      ll x;
      scanf(" %lld", &x);
      int lvl = get_lvl(x);
      ll cur_pos = snum(lvl, x, off[lvl]);
      while (cur_pos != 1) {
        printf("%lld ", snum(lvl, cur_pos, -off[lvl]));
        cur_pos /= 2;
        lvl -= 1;
      }
      printf("1\n");
    } else {
      assert(false);
    }
  }
  return 0;
}
