#include <bits/stdc++.h>
using namespace std;
const int MAXN = 70;
int Q;
int type;
long long x, k;
long long level[MAXN];
vector<long long> answer;
int getLevel(long long x) {
  int answer = 0;
  while (x != 0) {
    x /= 2;
    answer++;
  }
  return answer - 1;
}
long long fix(long long x, long long len) {
  if (x >= len) return x % len;
  if (x >= 0 && x < len) return x;
  return x % len + len;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j;
  long long update = 0, current;
  cin >> Q;
  for (int q = 0; q < Q; q++) {
    cin >> type;
    if (type == 1) {
      cin >> x >> k;
      current = getLevel(x);
      level[current] = (level[current] + k) % (1LL << (current));
    } else if (type == 2) {
      cin >> x >> k;
      current = getLevel(x);
      for (i = current; i < 63; i++) {
        update = k;
        for (j = current; j < i; j++) {
          update = (update * 2) % (1LL << (i));
        }
        level[i] = (level[i] + update) % (1LL << i);
      }
    } else {
      cin >> x;
      current = getLevel(x);
      x = fix(x - ((1LL << (current)) - 1) + level[current] - 1,
              (1LL << (current))) +
          ((1LL << (current)) - 1) + 1;
      while (current != 0) {
        cout << fix(x - ((1LL << (current)) - 1) - level[current] - 1,
                    (1LL << (current))) +
                    ((1LL << (current)) - 1) + 1
             << " ";
        x /= 2;
        current--;
      }
      cout << "1" << '\n';
    }
  }
}
