#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  long long moved[60] = {0};
  for (int t = 0; t < q; t++) {
    int type;
    cin >> type;
    switch (type) {
      case 1: {
        long long x, d;
        cin >> x >> d;
        int p2 = 63 - __builtin_clzll(x);
        d %= (long long)1 << ((int)log2(x));
        moved[p2] = (moved[p2] + d) % ((long long)1 << p2);
        break;
      }
      case 2: {
        long long x, d;
        cin >> x >> d;
        d %= (long long)1 << ((int)log2(x));
        for (int p2 = 63 - __builtin_clzll(x); p2 < 60; p2++, d *= 2)
          moved[p2] = (moved[p2] + d) % ((long long)1 << p2);
        break;
      }
      case 3: {
        long long x;
        cin >> x;
        int p2 = 63 - __builtin_clzll(x);
        cout << x << ' ';
        x = ((long long)1 << p2) + ((x + moved[p2]) % ((long long)1 << p2));
        x /= 2;
        p2--;
        while (x) {
          cout << ((long long)1 << p2) +
                      ((x - moved[p2]) % ((long long)1 << p2))
               << ' ';
          ;
          p2--;
          x /= 2;
        }
        cout << '\n';
        break;
      }
    }
  }
  return 0;
}
