#include <bits/stdc++.h>
using namespace std;
int q;
long long t, x, k;
long long pow2[63], lmost[63];
void init() {
  long long res = 1;
  for (int i = 0; i < 62; i++) lmost[i] = pow2[i] = res, res <<= 1;
}
void q1(long long x, long long k) {
  int level = 0;
  while (pow2[level + 1] <= x) {
    level++;
  }
  lmost[level] = (-k + lmost[level] + pow2[level]) % pow2[level] + pow2[level];
}
void q2(long long x, long long k) {
  int level = 0;
  while (pow2[level + 1] <= x) {
    level++;
  }
  while (level < 62)
    lmost[level] =
        (-k + lmost[level] + pow2[level]) % pow2[level] + pow2[level],
    k = (k + pow2[level]) % pow2[level] * 2, level++;
}
void q3(long long x) {
  int level = 0;
  long long curloc = 0;
  while (pow2[level + 1] <= x) {
    level++;
  }
  curloc = (x - lmost[level] + pow2[level]) % pow2[level];
  while (level >= 0) {
    long long now = (curloc + lmost[level]) % pow2[level] + pow2[level];
    printf("%I64d ", now);
    level--;
    curloc /= 2;
  }
  printf("\n");
}
int main() {
  init();
  scanf("%d", &q);
  while (q--) {
    scanf("%I64d", &t);
    if (t == 1) {
      scanf("%I64d%I64d", &x, &k);
      q1(x, k);
    } else if (t == 2) {
      scanf("%I64d%I64d", &x, &k);
      q2(x, k);
    } else {
      scanf("%I64d", &x);
      q3(x);
    }
  }
}
