#include <bits/stdc++.h>
using namespace std;
long long mx, shift[61];
long long GETLEVEL(long long x) { return (64 - (__builtin_clzll(x))); }
void SHIFT(long long lev, long long k) {
  mx = (1ll << (lev - 1));
  k = k % mx;
  shift[lev] += k;
  if (shift[lev] >= mx) shift[lev] -= mx;
  if (shift[lev] <= -mx) shift[lev] += mx;
}
long long GETNODE(long long lev, long long org) {
  long long x, m, prv, cur;
  x = org;
  m = (1ll << (lev - 1));
  prv = x - m;
  cur = (((prv + (-1ll * shift[lev])) % m) + m) % m;
  x = m + cur;
  return x;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long q;
  cin >> q;
  long long t, x, k, lev, s, m, par, prv, cur, org;
  for (long long i = 0; i < 61; i++) shift[i] = 0;
  for (long long i = 0; i < q; i++) {
    cin >> t;
    if (t == 1) {
      cin >> x >> k;
      lev = GETLEVEL(x);
      SHIFT(lev, k);
    } else if (t == 2) {
      cin >> x >> k;
      lev = GETLEVEL(x);
      m = 0;
      for (long long i = lev; i < 61; i++) {
        s = (1ll << m) * k;
        SHIFT(i, s);
        m++;
      }
    } else {
      cin >> x;
      lev = GETLEVEL(x);
      cout << x << " ";
      m = (1ll << (lev - 1));
      prv = x - m;
      cur = (((prv + shift[lev]) % m) + m) % m;
      x = m + cur;
      x /= 2;
      org = x;
      lev--;
      while (lev > 0) {
        cout << GETNODE(lev, org) << " ";
        org /= 2;
        lev--;
      }
      cout << "\n";
    }
  }
  return 0;
}
