#include <bits/stdc++.h>
using namespace std;
const int maxn = 65;
long long int a[maxn];
long long int mod[maxn];
int getcen(long long int x) {
  for (int i = 60; i > 0; i--)
    if (x >= mod[i]) return i;
  return 60;
}
int main() {
  int n;
  mod[1] = 1;
  for (int i = 2; i <= 60; i++) {
    mod[i] = 2 * mod[i - 1];
  }
  scanf("%d", &n);
  while (n--) {
    long long int t, x, k;
    scanf("%lld", &t);
    if (t == 1) {
      scanf("%lld%lld", &x, &k);
      int c = getcen(x);
      a[c] = (a[c] + k) % mod[c];
    }
    if (t == 2) {
      scanf("%lld%lld", &x, &k);
      int c = getcen(x);
      k = k % mod[c];
      for (int i = c; i <= 60; i++) {
        a[i] = (a[i] + k) % mod[i];
        k = k * 2;
      }
    }
    if (t == 3) {
      scanf("%lld", &x);
      int c = getcen(x);
      x = x + a[c];
      if (x >= 2 * mod[c]) x -= mod[c];
      if (x < mod[c]) x += mod[c];
      while (c > 0) {
        long long int t = x - a[c];
        if (t < mod[c]) t = t + mod[c];
        if (t >= 2 * mod[c]) t = t - mod[c];
        if (c == 1)
          printf("%lld\n", t);
        else
          printf("%lld ", t);
        x /= 2;
        c--;
      }
    }
  }
  return 0;
}
