#include <bits/stdc++.h>
using namespace std;
long long int level[70][3], shift[70], par[70];
void print(long long int x, long long int i) {
  long long int tmp = (x - shift[i]);
  if (tmp < level[i][0])
    tmp = (level[i][1] + 1 - level[i][0] + tmp);
  else if (tmp > level[i][1])
    tmp = (level[i][0] - 1 - level[i][1] + tmp);
  printf("%lld ", tmp);
  if (x == 1) return;
  x += par[i] % (level[i][1] - level[i][0] + 1);
  if (x < level[i][0])
    x = (level[i][1] + 1 - level[i][0] + x);
  else if (x > level[i][1])
    x = (level[i][0] - 1 - level[i][1] + x);
  print(x / 2, i - 1);
}
int main() {
  long long int x, k, i;
  int q, t;
  for (i = 0; i < 60; i++) {
    level[i][0] = (1ll << i);
    level[i][1] = (1ll << (i + 1)) - 1;
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%d %lld", &t, &x);
    for (i = 0;; i++)
      if (level[i][0] <= x && x <= level[i][1]) break;
    if (t == 3) {
      x += shift[i];
      if (x < level[i][0])
        x = (level[i][1] + 1 - level[i][0] + x);
      else if (x > level[i][1])
        x = (level[i][0] - 1 - level[i][1] + x);
      print(x, i);
      printf("\n");
    } else {
      scanf("%lld", &k);
      if (t == 1) {
        shift[i] = (k + shift[i]) % (level[i][1] - level[i][0] + 1);
      } else
        par[i] = (k + par[i]) % (level[i][1] - level[i][0] + 1);
    }
  }
  return 0;
}
