#include <bits/stdc++.h>
using namespace std;
int Q;
long long query1[62], query2[62];
int main() {
  scanf("%d", &Q);
  for (int i = 0; i < Q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      long long x, k;
      scanf("%lld %lld", &x, &k);
      int p;
      for (int j = 0; j <= 60; j++) {
        if ((1LL << j) <= x && x < (1LL << (j + 1))) {
          p = j;
          break;
        }
      }
      query1[p] += k;
      query1[p] = (query1[p] % (1LL << p) + (1LL << p)) % (1LL << p);
    }
    if (t == 2) {
      long long x, k;
      scanf("%lld %lld", &x, &k);
      int p;
      for (int j = 0; j <= 60; j++) {
        if ((1LL << j) <= x && x < (1LL << (j + 1))) {
          p = j;
          break;
        }
      }
      query2[p] += k;
      query2[p] = (query2[p] % (1LL << p) + (1LL << p)) % (1LL << p);
    }
    if (t == 3) {
      long long x;
      scanf("%lld", &x);
      int p;
      for (int j = 0; j <= 60; j++) {
        if ((1LL << j) <= x && x < (1LL << (j + 1))) {
          p = j;
          break;
        }
      }
      while (x != 1) {
        printf("%lld ", x);
        long long y = x % (1LL << p);
        y += query1[p];
        y %= (1LL << p);
        y += query2[p];
        y %= (1LL << p);
        y += (1LL << p);
        y /= 2;
        y %= (1LL << (p - 1));
        y += (1LL << (p - 1)) - query1[p - 1];
        y %= (1LL << (p - 1));
        x = y + (1LL << (p - 1));
        p--;
      }
      printf("1\n");
    }
  }
}
