#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int Q;
  cin >> Q;
  vector<long long> shift(64, 0);
  for (int qq = 0; qq < Q; ++qq) {
    int type;
    long long x;
    cin >> type;
    cin >> x;
    int level = 64 - __builtin_clzll(x);
    if (type < 3) {
      long long k;
      cin >> k;
      if (type == 1) {
        shift[level] =
            (shift[level] + k + (1LL << (level - 1))) % (1LL << (level - 1));
      } else {
        int lvl = level;
        long long amt = k;
        for (; lvl < 63; amt <<= 1, lvl++) {
          shift[lvl] =
              (shift[lvl] + amt + (1LL << (lvl - 1))) % (1LL << (lvl - 1));
        }
      }
    } else {
      int lev = level;
      long long pos =
          (x + shift[lev]) % (1LL << (lev - 1)) + (1LL << (lev - 1));
      while (pos > 0) {
        cout << (pos - shift[lev]) % (1LL << (lev - 1)) + (1LL << (lev - 1))
             << " ";
        pos >>= 1;
        --lev;
      }
      cout << "\n";
    }
  }
  return 0;
}
