#include <bits/stdc++.h>
using namespace std;
long long shift[65];
long long two[65];
long long getlevel(long long node) {
  for (long long i = 1; i <= 60; i++) {
    if (two[i] + 1 > node) return i;
  }
}
void printshift() {
  for (int i = 1; i <= 4; i++) {
    printf("%lld ", shift[i]);
  }
  puts("");
}
int main() {
  two[0] = 1;
  for (long long i = 1; i <= 60; i++) {
    two[i] = two[i - 1] * 2;
  }
  for (long long i = 0; i <= 60; i++) {
    two[i]--;
  }
  int q;
  scanf("%d", &q);
  for (int _z = 0; _z < q; _z++) {
    int type;
    long long x, k;
    scanf("%d", &type);
    if (type == 1) {
      scanf("%lld %lld", &x, &k);
      long long L = getlevel(x);
      k += (two[60] + 1);
      k %= (two[L] - two[L - 1]);
      shift[L] += k;
      shift[L] %= (two[L] - two[L - 1]);
    } else if (type == 2) {
      scanf("%lld %lld", &x, &k);
      long long L = getlevel(x);
      k += (two[60] + 1);
      for (int i = L; i <= 60; i++) {
        k %= (two[i] - two[i - 1]);
        shift[i] += k;
        shift[i] %= (two[i] - two[i - 1]);
        k += k;
      }
    } else {
      scanf("%lld", &x);
      long long L = getlevel(x);
      x -= two[L - 1];
      x += shift[L];
      x %= (two[L] - two[L - 1]);
      if (x == 0) x = two[L] - two[L - 1];
      x += two[L - 1];
      for (int i = L; i >= 2; i--) {
        long long p = x;
        p -= two[i - 1];
        p -= shift[i];
        p += (two[i] - two[i - 1]);
        p %= (two[i] - two[i - 1]);
        if (p == 0) p = two[i] - two[i - 1];
        p += two[i - 1];
        printf("%lld ", p);
        x /= 2;
      }
      printf("1\n");
    }
  }
  return 0;
}
