#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3f3f3f3f;
const int mxN = 61;
ll level[mxN];
int q;
int getlevel(ll x) {
  int res = 0;
  while ((1LL << res) <= x) {
    res++;
  }
  return res - 1;
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> q;
  ll a, b, c;
  for (int i = 0; i < q; ++i) {
    cin >> a;
    if (a == 1 || a == 2) {
      cin >> b >> c;
      if (a == 1) {
        level[getlevel(b)] += c;
      } else {
        int l = getlevel(b);
        for (int i = l; i < 61; ++i) {
          level[i] = (level[i] + c * (1LL << (i - l))) % (1LL << i);
        }
      }
    } else {
      cin >> b;
      int l = getlevel(b);
      ll out = b - (1LL << l);
      out = (out + level[l]) % (1LL << l);
      if (out < 0) {
        out = out + (1LL << l);
      }
      out = (out + (1LL << l));
      for (int i = l; i >= 0; --i) {
        ll ans = (out - (1LL << i) - level[i]) % (1LL << i);
        if (ans < 0) {
          ans += (1LL << i);
        }
        ans = (ans + (1LL << i));
        cout << ans << " ";
        out /= 2;
      }
      cout << "\n";
    }
  }
  return 0;
}
