#include <bits/stdc++.h>
using namespace std;
long long t, n, i, j, k, x, y, z, l, r, mid, ans, mod = 1e9 + 7, g, m;
long long a[400005], b[400005], c[400005];
char ch;
string s, st;
vector<long long> v[300005], u;
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  cin >> m;
  while (m--) {
    cin >> x;
    if (x == 1) {
      cin >> y >> k;
      for (i = 60; i >= 0; i--)
        if ((1LL << i) & y) break;
      a[i] = ((a[i] - k) % (1LL << i) + (1LL << i)) % (1LL << i);
    }
    if (x == 2) {
      cin >> y >> k;
      for (i = 60; i >= 0; i--)
        if ((1LL << i) & y) break;
      for (i; i <= 60; i++) {
        a[i] = ((a[i] - k) % (1LL << i) + (1LL << i)) % (1LL << i);
        k <<= 1;
      }
    }
    if (x == 3) {
      cin >> y;
      cout << y << " ";
      for (i = 60; i >= 0; i--)
        if ((1LL << i) & y) break;
      for (i = i - 1; i >= 0; i--) {
        z = y - a[i + 1];
        y = z / 2 + a[i];
        if (y >= (1LL << (i + 1))) y -= (1LL << i);
        if (y < (1LL << i)) y += (1LL << i);
        cout << y << " ";
      }
      cout << "\n";
    }
  }
}
