#include <bits/stdc++.h>
using namespace std;
long long sh[70];
int q;
int level(long long nod) {
  int biti = 0;
  while (nod) nod >>= 1, biti++;
  return biti;
}
int main() {
  scanf("%d", &q);
  while (q--) {
    int tip;
    scanf("%d", &tip);
    if (tip == 1) {
      long long x, lvl, val;
      scanf("%I64d%I64d", &x, &val);
      lvl = level(x);
      val %= (1LL << (lvl - 1));
      if (val < 0) val += (1LL << (lvl - 1));
      sh[lvl] += val;
      if (sh[lvl] >= (1LL << (lvl - 1))) sh[lvl] -= (1LL << (lvl - 1));
    } else if (tip == 2) {
      long long x, lvl, val;
      scanf("%I64d%I64d", &x, &val);
      lvl = level(x);
      val %= (1LL << (lvl - 1));
      if (val < 0) val += (1LL << (lvl - 1));
      for (int i = lvl; i < 63; i++) {
        sh[i] += val;
        sh[i] %= (1LL << (i - 1));
        val <<= 1;
      }
    } else {
      long long x;
      scanf("%I64d", &x);
      int lvl = level(x);
      x -= (1LL << (lvl - 1));
      x = (x + sh[lvl]) % (1LL << (lvl - 1));
      for (int i = lvl; i >= 1; i--) {
        long long r = x + (1LL << (i - 1)) - sh[i];
        if (r < 0) r += (1LL << (i - 1));
        if (r >= (1LL << (i - 1))) r -= (1LL << (i - 1));
        printf("%I64d ", r + (1LL << (i - 1)));
        x >>= 1;
      }
      printf("\n");
    }
  }
  return 0;
}
