#include <bits/stdc++.h>
using namespace std;
const long long MAXH = 64 + 3;
long long q, fc[MAXH], sc[MAXH], md[MAXH];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  md[0] = 1;
  for (long long i = 1; i < 64; i++) md[i] = (md[i - 1] << 1);
  cin >> q;
  while (q--) {
    long long t, x, k;
    cin >> t >> x;
    if (t != 3) {
      cin >> k;
      x = (63 - __builtin_clzll(x));
      if (t == 1)
        fc[x] -= k;
      else
        sc[x] -= k;
    } else {
      long long y = (63 - __builtin_clzll(x));
      long long rp = ((((((x - fc[y] - sc[y] - (1ll << y)) % md[y]) + md[y]) %
                        md[y]) +
                       (1ll << y)) >>
                      1),
                f = x;
      vector<long long> v;
      v.push_back(x);
      while (y--) {
        f = ((((rp + fc[y] - (1ll << y)) % md[y]) + md[y]) % md[y]) +
            (1ll << y);
        rp = ((((((f - fc[y] - sc[y] - (1ll << y)) % md[y]) + md[y]) % md[y]) +
               (1ll << y)) >>
              1);
        v.push_back(f);
      }
      for (auto i : v) cout << i << ' ';
      cout << '\n';
    }
  }
  return 0;
}
