#include <bits/stdc++.h>
using namespace std;
long long x, k, val, val1, power[65], res[65];
int main() {
  int q, i, typ, j;
  scanf("%d", &q);
  for (i = 0; i < 64; i++) {
    power[i] = i > 0 ? power[i - 1] * 2LL : 1;
  }
  for (i = 0; i < q; i++) {
    scanf("%d", &typ);
    if (typ == 1) {
      scanf("%lld%lld", &x, &k);
      for (j = 0; j < 65; j++) {
        if (x / power[j] == 0) {
          break;
        }
      }
      val = (j - 1);
      val++;
      res[val] += k;
      res[val] %= power[val - 1];
      if (res[val] < 0) {
        res[val] += power[val - 1];
        res[val] %= power[val - 1];
      }
    } else if (typ == 2) {
      scanf("%lld%lld", &x, &k);
      for (j = 0; j < 65; j++) {
        if (x / power[j] == 0) {
          break;
        }
      }
      val = (j - 1);
      val++;
      for (j = val; j < 64; j++) {
        res[j] += (k % power[j - 1]) * power[j - val];
        res[j] %= power[j - 1];
        if (res[j] < 0) {
          res[j] += power[j - 1];
          res[j] %= power[j - 1];
        }
      }
    } else {
      scanf("%lld", &x);
      for (j = 0; j < 65; j++) {
        if (x / power[j] == 0) {
          break;
        }
      }
      val = (j - 1);
      val++;
      printf("%lld ", x);
      if (x + res[val] < power[val]) {
        x = x + res[val];
      } else {
        val1 = res[val];
        val1 -= (power[val] - x);
        x = power[val - 1] + val1;
      }
      x /= 2;
      long long x1;
      while (x > 0) {
        val--;
        if (power[val - 1] + res[val] <= x) {
          x1 = x - res[val];
        } else {
          x1 = power[val] - (res[val] + power[val - 1] - x);
        }
        printf("%lld ", x1);
        x /= 2;
      }
      printf("\n");
    }
  }
}
