#include <bits/stdc++.h>
using namespace std;
const long long N = 10000;
const long long M = 60;
vector<long long> v;
long long n, first, t, a[N], second, cn, p;
void val(long long first) {
  long long second, z;
  second = first;
  first = upper_bound((v).begin(), (v).end(), first) - v.begin() - 1;
  ;
  second = (second - v[first] + a[first]) % v[first];
  z = second + v[first];
  while (1) {
    second = z - v[first];
    p = (second - a[first] >= 0) ? (v[first] + (second - a[first]))
                                 : (v[first] * 2 - (a[first] - second));
    cout << p << " ";
    if (p == 1) break;
    first--;
    z >>= 1;
  }
}
int main() {
  cin >> n;
  for (long long i = (long long)0; i <= (long long)M; i++)
    v.push_back((1LL << i));
  for (long long i = (long long)1; i <= (long long)n; i++) {
    cin >> t;
    if (t <= 2) {
      cin >> first >> second;
      first = upper_bound((v).begin(), (v).end(), first) - v.begin() - 1;
      ;
      for (long long j = (long long)first; j <= (long long)M; j++) {
        a[j] += (second % v[j]) * (1LL << (j - first));
        if (a[j] < 0) a[j] %= v[j], a[j] += v[j];
        a[j] %= v[j];
        if (t == 1) break;
      }
    } else {
      cn++;
      cin >> first;
      val(first);
      cout << ""
           << "\n";
    }
  }
}
