#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int getLevel(long long x) {
  if (x == 1) return 1;
  return 1 + getLevel(x / 2);
}
int q;
long long cur[maxn];
long long t, x, k;
int main() {
  for (int i = 1; i <= 60; i++) {
    cur[i] = (1ll << (i - 1));
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%lld%lld", &t, &x);
    int l = getLevel(x);
    long long s = (1ll << (l - 1)), L = s, R = s * 2 - 1;
    if (t == 1) {
      scanf("%lld", &k);
      k = (k % s + s) % s;
      cur[l] = (cur[l] - L - k + s) % s + L;
    } else if (t == 2) {
      scanf("%lld", &k);
      k = (k % s + s) % s;
      cur[l] = (cur[l] - L - k + s) % s + L;
      for (int i = l + 1; i <= 60; i++) {
        L *= 2;
        s *= 2;
        k = k * 2 % s;
        cur[i] = (cur[i] - L - k + s) % s + L;
      }
    } else {
      long long now = (x - L - (cur[l] - L) + s) % s + L;
      printf("%lld", x);
      while (now > 1) {
        now /= 2;
        s /= 2;
        L /= 2;
        --l;
        printf(" %lld", (now - L + cur[l] - L) % s + L);
      }
      puts("");
    }
  }
  return 0;
}
