#include <bits/stdc++.h>
using namespace std;
const int N = 611090;
const long long MOD = 1000000007LL;
const int fx[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
double pi = acos(-1.0);
inline int lowbit(int x) { return x & (-x); }
void gcd(long long a, long long b, long long &d, long long &x, long long &y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    gcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long inv(long long a, long long n) {
  long long d, x, y;
  gcd(a, n, d, x, y);
  return (x + n) % n;
}
long long a[70];
int n;
int main() {
  int cases = 1;
  double ans = 0;
  for (int iii = 1; iii <= cases; ++iii) {
    scanf("%d", &n);
    for (int nn = 0; nn < n; ++nn) {
      int op;
      scanf("%d", &op);
      if (op == 1) {
        long long x, y;
        scanf("%lld%lld", &x, &y);
        if (!y) continue;
        long long temp = 61, temp1 = temp;
        while ((1LL << temp) > x) --temp;
        temp1 = temp;
        temp = 1LL << temp;
        if (y < 0) y = ((-y) / temp * temp + y);
        y = (y + (temp)) % (temp);
        a[temp1] = (a[temp1] + y) % temp;
      } else if (op == 2) {
        long long x, y;
        scanf("%lld%lld", &x, &y);
        if (!y) continue;
        long long temp = 61, temp1 = temp;
        while ((1LL << temp) > x) --temp;
        temp1 = temp;
        temp = 1LL << temp;
        if (y < 0) y = ((-y) / temp * temp + y);
        y = (y + (temp)) % (temp);
        for (; temp1 < 61LL; ++temp1) {
          a[temp1] = (a[temp1] + y) % (1LL << temp1);
          y = y * 2 % (2LL << temp1);
        }
      } else {
        long long x;
        scanf("%lld", &x);
        long long temp = 61, temp1 = temp;
        while ((1LL << temp) > x) --temp;
        x = x + a[temp];
        if (x >= (2LL << temp)) x -= (1LL << (temp));
        while (x) {
          printf("%lld",
                 (x + (1LL << temp) - a[temp]) % (1LL << temp) + (1LL << temp));
          x >>= 1;
          --temp;
          if (x)
            printf(" ");
          else
            printf("\n");
        }
      }
    }
  }
}
