#include <bits/stdc++.h>
using namespace std;
const long long LIMIT = 2e18;
long long shift[200];
int find_level(long long x) {
  int ans = 0;
  for (int level = 0;; level++) {
    if (1LL << level <= x) {
      ans = level;
    } else {
      break;
    }
  }
  return ans;
}
int main() {
  int q, typ;
  long long x, k;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &typ);
    if (typ == 1) {
      scanf("%lld%lld", &x, &k);
      int level = find_level(x);
      long long mod = 1LL << level;
      shift[level] += k % mod;
      shift[level] %= mod;
    } else if (typ == 2) {
      scanf("%lld%lld", &x, &k);
      int level = find_level(x);
      for (; 1LL << level <= LIMIT; level++) {
        long long mod = 1LL << level;
        shift[level] += k % mod;
        shift[level] %= mod;
        k *= 2;
      }
    } else {
      scanf("%lld", &x);
      printf("%lld ", x);
      int level = find_level(x);
      long long mod = 1LL << level;
      long long actual = mod + (x + shift[level]) % mod;
      actual /= 2;
      level--;
      while (actual) {
        long long mod = 1LL << level;
        printf("%lld ", mod + (actual + mod - shift[level]) % mod);
        actual /= 2;
        level--;
      }
      printf("\n");
    }
  }
  return 0;
}
