#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int MAX_LEVELS = 100;
long long shift[MAX_LEVELS], levelSize[MAX_LEVELS], acc[MAX_LEVELS];
int getLevel(long long k) {
  for (int i = 1;; i += 1) {
    if (k <= acc[i]) {
      return i;
    }
  }
}
void cyclicShift(int lvl, long long k) {
  shift[lvl] += k;
  shift[lvl] %= levelSize[lvl];
}
void reduce(int lvl, long long& k) {
  k %= levelSize[lvl];
  if (k < 0) k += levelSize[lvl];
}
long long query(int lvl, long long x) {
  long long cur = x;
  cur -= shift[lvl];
  if (cur < levelSize[lvl]) cur += levelSize[lvl];
  return cur;
}
long long getLoc(int lvl, long long x) {
  long long cur = x;
  cur += shift[lvl];
  if (cur > acc[lvl]) cur -= levelSize[lvl];
  return cur;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long allNodes = 0, sz = 1, level = 1;
  int maxLevel = 0;
  while (allNodes <= 1e18) {
    maxLevel = level;
    allNodes += sz;
    acc[level] = allNodes;
    levelSize[level] = sz;
    sz <<= 1;
    level += 1;
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int choice;
    cin >> choice;
    if (choice == 3) {
      long long x;
      cin >> x;
      int lvl = getLevel(x);
      x = getLoc(lvl, x);
      while (lvl >= 1) {
        cout << query(lvl, x) << " ";
        x /= 2;
        lvl -= 1;
      }
      cout << endl;
    } else {
      long long x, k;
      cin >> x >> k;
      int lvl = getLevel(x);
      reduce(lvl, k);
      if (choice == 1)
        cyclicShift(lvl, k);
      else {
        long long fac = 1;
        for (int j = lvl; j <= maxLevel; ++j) {
          cyclicShift(j, k * fac);
          fac <<= 1;
        }
      }
    }
  }
  return 0;
}
