#include <bits/stdc++.h>
using namespace std;
long long a[65];
long long level(long long x) {
  int sum = 0;
  for (; x != 1; x /= 2) {
    sum++;
  }
  return sum;
}
void write(long long a) {
  if (a == 0)
    putchar('0');
  else {
    static char c[20];
    static int c0;
    c0 = 0;
    while (a) c[c0++] = a % 10 + '0', a /= 10;
    while (c0--) putchar(c[c0]);
  }
}
void get_val(long long x, int l) {
  write((x - a[l]) % (1ll << l) + (1ll << l));
  putchar(' ');
  if (x == 1) return;
  get_val(x / 2, l - 1);
}
int main() {
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  int i;
  for (i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      long long x, k;
      cin >> x >> k;
      x = level(x);
      a[x] += k;
      a[x] %= (1ll << x);
      a[x] += (1ll << x);
      a[x] %= (1ll << x);
    } else if (t == 2) {
      long long x, k;
      cin >> x >> k;
      x = level(x);
      k %= (1ll << x);
      for (; x <= 60; x++) {
        a[x] += k;
        a[x] %= (1ll << x);
        a[x] += (1ll << x);
        a[x] %= (1ll << x);
        k <<= 1;
      }
    } else {
      long long x;
      cin >> x;
      int k = level(x);
      x += a[k];
      x %= (1ll << k);
      x += (1ll << k);
      get_val(x, level(x));
      putchar('\n');
    }
  }
  return 0;
}
