#include <bits/stdc++.h>
using namespace std;
int linie(long long x) {
  for (int i = 60; i >= 0; --i) {
    if (x >= (1LL << i)) {
      return i;
    }
  }
}
void tl(long long &k, int l) {
  k &= (1LL << l) - 1LL;
  if (k < 0) {
    k += 1LL << l;
  }
}
long long op1[70];
long long op2[70];
int main() {
  int q, t, l;
  long long x, k;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    cin >> t;
    if (t == 1) {
      cin >> x >> k;
      l = linie(x);
      tl(k, l);
      op1[l] += k;
      op1[l] &= (1LL << l) - 1LL;
    }
    if (t == 2) {
      cin >> x >> k;
      l = linie(x);
      tl(k, l);
      op2[l] += k;
      op2[l] &= (1LL << l) - 1LL;
    }
    if (t == 3) {
      cin >> x;
      int poz = linie(x);
      x = (x + op1[poz]) % (1LL << poz) + (1LL << poz);
      while (x > 1 && poz > 0) {
        cout << (x - op1[poz]) % (1LL << poz) + (1LL << poz) << " ";
        x = ((x + op2[poz]) % (1LL << poz) + (1LL << poz)) >> 1LL;
        --poz;
      }
      cout << "1\n";
    }
  }
  return 0;
}
