#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int Q;
  cin >> Q;
  long long S[61];
  fill(S, S + 61, 0);
  while (Q--) {
    int T;
    long long X, K;
    cin >> T;
    cin >> X;
    int L = 64 - __builtin_clzll(X);
    if (T != 3) {
      cin >> K;
      int eL = 60;
      if (T == 1) eL = L;
      for (int i = 0; L + i <= eL; i++) {
        S[L + i] += (K << i);
        S[L + i] &= ((1LL << (L + i - 1)) - 1);
      }
    } else {
      long long sh = 1;
      sh <<= L - 1;
      long long P = X - sh;
      long long Ph = (((P + S[L]) & (sh - 1)) + sh) & (sh - 1);
      long long V = sh + Ph;
      V >>= 1;
      sh >>= 1;
      L--;
      cout << X;
      while (V) {
        P = V - sh;
        Ph = (((P - S[L]) & (sh - 1)) + sh) & (sh - 1);
        cout << ' ' << sh + Ph;
        L--;
        V >>= 1;
        sh >>= 1;
      }
      cout << '\n';
    }
  }
  return 0;
}
