#include <bits/stdc++.h>
using namespace std;
const int RANK = 60;
int Q;
long long T, x, k;
long long det[102], cnt[102];
int get_rank(long long x) {
  int ret = 0;
  while (x) {
    x /= 2;
    ret++;
  }
  return ret;
}
int main() {
  cnt[1] = 1;
  for (int i = 2; i <= RANK + 1; i++) cnt[i] = cnt[i - 1] * 2L;
  scanf("%d", &Q);
  while (Q--) {
    scanf("%lld %lld", &T, &x);
    int rk = get_rank(x);
    if (T == 1) {
      scanf("%lld", &k);
      det[rk] = (det[rk] + k) % cnt[rk];
    }
    if (T == 2) {
      scanf("%lld", &k);
      long long dt = k;
      for (int i = rk; i <= RANK; i++) {
        det[i] = (det[i] + dt) % cnt[i];
        dt = (dt * 2L) % cnt[RANK + 1];
      }
    }
    if (T == 3) {
      long long dt = det[rk];
      dt = (dt % cnt[rk] + cnt[rk]) % cnt[rk];
      long long cur = x + dt;
      if (cur >= cnt[rk + 1]) cur -= cnt[rk];
      printf("%lld ", x);
      cur /= 2;
      while (cur) {
        long long dt = det[--rk];
        dt = (dt % cnt[rk] + cnt[rk]) % cnt[rk];
        long long ans = cur - dt;
        if (ans < cnt[rk]) ans += cnt[rk];
        printf("%lld ", ans);
        cur /= 2;
      }
      printf("\n");
    }
  }
}
