#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _dbg(char const *s, const T &t) {
  cout << s << "=" << t << endl;
}
template <typename T, typename... TA>
void _dbg(char const *s, const T &t, const TA &...ta) {
  while (*s != ',') cout << *s++;
  cout << "=" << t << ",";
  _dbg(s + 1, ta...);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "}";
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
  os << "{";
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    if (it != mp.begin()) os << ",";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << "{";
  for (auto it = s.begin(); it != s.end(); ++it) {
    if (it != s.begin()) os << ",";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &s) {
  os << "{";
  for (auto it = s.begin(); it != s.end(); ++it) {
    if (it != s.begin()) os << ",";
    os << *it;
  }
  return os << "}";
}
const int LOG = 63;
int glvl(long long x) {
  int res = 0;
  while (x) {
    res++;
    x >>= 1;
  }
  return res - 1;
}
void solve() {
  int q;
  scanf("%d", &q);
  vector<long long> d(LOG, 0);
  auto shift = [&](int lvl, long long k) {
    d[lvl] += k;
    d[lvl] %= 1LL << lvl;
    if (d[lvl] < 0) d[lvl] += 1LL << lvl;
  };
  while (q--) {
    int t;
    long long x, k;
    scanf("%d", &t);
    ;
    if (t == 1) {
      scanf("%lld%lld", &x, &k);
      int lvl = glvl(x);
      shift(lvl, k);
    } else if (t == 2) {
      scanf("%lld%lld", &x, &k);
      int lvl = glvl(x);
      k %= 1LL << lvl;
      if (k < 0) k += 1LL << lvl;
      for (; lvl < LOG; ++lvl) {
        shift(lvl, k);
        k <<= 1;
      }
    } else if (t == 3) {
      scanf("%lld", &x);
      int lvl = glvl(x);
      long long pos = x + d[lvl];
      while (pos >= (1LL << (lvl + 1))) pos -= 1LL << lvl;
      while (pos) {
        long long y = pos - d[lvl];
        while (y < (1LL << lvl)) y += 1LL << lvl;
        printf("%lld ", y);
        pos >>= 1;
        lvl--;
      }
      puts("");
    } else {
      throw;
    }
  }
}
int main() {
  solve();
  return 0;
}
