#include <bits/stdc++.h>
using namespace std;
long long arr[100], x, k;
long long solve(int level, long long pos) {
  long long v = (1LL << level);
  return (pos - arr[level] + v) % v + v;
}
int getlevel(long long v) {
  for (int i = 0; i < 62; i++) {
    if ((1LL << i) <= v && v < (1LL << (i + 1))) {
      return i;
    }
  }
}
long long getpos(long long x, int level) {
  long long v = (1LL << level);
  return (x + v) % v;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  ;
  int Q;
  cin >> Q;
  while (Q--) {
    int type;
    cin >> type;
    if (type < 3) {
      cin >> x >> k;
      int level = getlevel(x);
      long long v = (1LL << level);
      k = (k + v) % v;
      arr[level] = (arr[level] + k) % v;
      if (type > 1) {
        while (level++ < 62) {
          k = 2LL * k, v = 2LL * v;
          arr[level] = (arr[level] + k) % v;
        }
      }
    } else {
      cin >> x;
      int level = getlevel(x);
      long long v = (1LL << level);
      long long now = v + (arr[level] + getpos(x, level)) % v;
      while (level >= 0) {
        cout << solve(level, getpos(now, level)) << " ";
        now = now / 2LL, level--;
      }
      cout << endl;
    }
  }
  return 0;
}
