#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int read(T& x) {
  int c, sign = 1;
  x = 0;
  while (!(((c = getchar()) >= '0' && c <= '9') || c == '-'))
    if (c == EOF) return c;
  if (c == '-')
    sign = -1;
  else
    x = x * 10 + c - '0';
  while (((c = getchar()) >= '0' && c <= '9')) x = x * 10 + c - '0';
  x *= sign;
  return 1;
}
int main() {
  long long q, t, x, k;
  long long v[60] = {0}, m[64];
  for (int i = 0; i < (64); ++i) m[i] = (1LL << i);
  read(q);
  while (q--) {
    read(t);
    read(x);
    if (t < 3) read(k);
    long long c = 0;
    while (x > m[c + 1] - 1) ++c;
    if (t == 1) {
      v[c] = (v[c] + k) % m[c];
    } else if (t == 2) {
      for (; c < 60; ++c) {
        v[c] = (v[c] + k) % m[c];
        k <<= 1;
      }
    } else {
      long long p = (x - m[c] + v[c] + m[c]) % m[c];
      for (; c > -1; --c) {
        x = m[c] + ((p - v[c] + m[c]) % m[c]);
        cout << x << " ";
        p >>= 1;
      }
      cout << "\n";
    }
  }
  return 0;
}
