#include <bits/stdc++.h>
using namespace std;
long long par[101];
vector<int> vec;
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    int t;
    long long x, k;
    scanf("%d %lld", &t, &x);
    if (t == 1) {
      scanf("%lld", &k);
      int d = 0;
      long long node = 1;
      while (node * 2 <= x) {
        node += node;
        d++;
      }
      par[d] = (par[d] + k) % node;
      par[d] = (par[d] + node) % node;
      par[d + 1] = (par[d + 1] - 2 * k) % (2 * node);
      par[d + 1] = (par[d + 1] + (2 * node)) % (2 * node);
    } else if (t == 2) {
      scanf("%lld", &k);
      int d = 0;
      long long node = 1;
      while (node * 2 <= x) {
        node += node;
        d++;
      }
      par[d] = (par[d] + k) % node;
      par[d] = (par[d] + node) % node;
    } else {
      vec.clear();
      int d = 0;
      long long node = 1;
      while (node * 2 <= x) {
        node += node;
        d++;
      }
      while (x != 1) {
        printf("%lld ", x);
        if (x + par[d] >= node * 2) {
          x = x + par[d] - node;
          x /= 2;
        } else {
          x = x + par[d];
          x /= 2;
        }
        d--;
        node /= 2;
      }
      printf("1\n");
    }
  }
}
