#include <bits/stdc++.h>
using namespace std;
long long s[60], h, mod;
void solve() {
  long long q;
  cin >> q;
  while (q--) {
    long long t, first, k;
    cin >> t;
    if (t == 1) {
      cin >> first >> k;
      long long r = first;
      h = -1;
      while (r) h++, r /= 2;
      mod = 1LL << h;
      k %= mod;
      if (k < 0) k += mod;
      s[h] += k;
      s[h] %= mod;
    } else if (t == 2) {
      cin >> first >> k;
      long long r = first;
      h = -1;
      while (r) h++, r /= 2;
      mod = 1LL << h;
      k %= mod;
      if (k < 0) k += mod;
      for (long long i = h; i < 60; i++) {
        s[i] += k;
        s[i] %= mod;
        mod = (mod * 2);
        k = (k * 2) % mod;
      }
    } else {
      cin >> first;
      h = -1;
      long long r = first;
      while (r) h++, r /= 2;
      mod = 1LL << h;
      cout << first << " ";
      first = (1LL << h) + (first - (1LL << h) + s[h]) % mod;
      while (first / 2) {
        first /= 2;
        h--;
        mod /= 2;
        long long second = (1LL << h) + (first - (1LL << h) + mod - s[h]) % mod;
        cout << second << " ";
      }
      cout << '\n';
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
