#include <bits/stdc++.h>
using namespace std;
long long L[70];
void ShiftLevel(long long lvl, long long val) {
  long long St = (1LL << (lvl - 1));
  val = (val % St) + St;
  L[lvl] = (L[lvl] + val) % St;
}
long long Adjust(long long lvl, long long T) {
  long long St = (1LL << (lvl - 1));
  long long Ed = (1LL << (lvl)) - 1;
  if (T > Ed) {
    T = St + (T % Ed) - 1;
  }
  if (T < St) {
    T = Ed - (St - T) + 1;
  }
  return T;
}
int main() {
  long long q, t, k, lvl;
  scanf("%lld", &q);
  while (q--) {
    scanf("%lld", &t);
    if (t == 1) {
      scanf("%lld", &lvl), scanf("%lld", &k);
      lvl = log2(lvl) + 1;
      ShiftLevel(lvl, k);
    } else if (t == 2) {
      scanf("%lld", &lvl), scanf("%lld", &k);
      lvl = log2(lvl) + 1;
      while (lvl <= 60LL) {
        ShiftLevel(lvl++, k);
        k = (k * 2);
      }
    } else {
      scanf("%lld", &k);
      lvl = log2(k) + 1;
      long long RealNode = Adjust(lvl, k + L[lvl]);
      printf("%lld ", k);
      while (lvl != 1) {
        --lvl;
        RealNode /= 2;
        long long T = RealNode - L[lvl];
        printf("%lld ", Adjust(lvl, T));
      }
      printf("\n");
    }
  }
  return 0;
}
