You have a full binary tree having infinite levels.

Each node has an initial value. If a node has value x, then its left child has value 2·x and its right child has value 2·x + 1. 

The value of the root is 1. 

You need to answer Q queries. 

There are 3 types of queries: 

  1. Cyclically shift the values of all nodes on the same level as node with value X by K units. (The values/nodes of any other level are not affected).
  2. Cyclically shift the nodes on the same level as node with value X by K units. (The subtrees of these nodes will move along with them).
  3. Print the value of every node encountered on the simple path from the node with value X to the root.



Positive K implies right cyclic shift and negative K implies left cyclic shift. 

It is guaranteed that atleast one type 3 query is present.

Input

The first line contains a single integer Q (1 ≤ Q ≤ 105).

Then Q queries follow, one per line: 

  * Queries of type 1 and 2 have the following format: T X K (1 ≤ T ≤ 2; 1 ≤ X ≤ 1018; 0 ≤ |K| ≤ 1018), where T is type of the query.
  * Queries of type 3 have the following format: 3 X (1 ≤ X ≤ 1018).

Output

For each query of type 3, print the values of all nodes encountered in descending order.

Examples

Input

5
3 12
1 2 1
3 12
2 4 -1
3 8


Output

12 6 3 1 
12 6 2 1 
8 4 2 1 


Input

5
3 14
1 5 -3
3 14
1 3 1
3 14


Output

14 7 3 1 
14 6 3 1 
14 6 2 1 

Note

Following are the images of the first 4 levels of the tree in the first test case:

Original: 

<image>

After query 1 2 1: 

<image>

After query 2 4 -1: 

<image>
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Int(T &n) {
  n = 0;
  int f = 1;
  register int ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
template <typename T>
T gcd(T a, T b) {
  return !b ? a : gcd(b, a % b);
}
template <typename T>
T modinverse(T bs) {
  return modpow(bs, 1000000007LL - 2);
}
template <typename T>
inline void umin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
inline void umax(T &a, T b) {
  a = a > b ? a : b;
}
template <typename T, typename W>
inline void Int(T &x, W &y) {
  Int(x), Int(y);
}
template <typename T, typename W, typename Q>
inline void Int(T &x, W &y, Q &z) {
  Int(x, y), Int(z);
}
const int N = 1e5 + 7;
const int inf = 1e9 + 7;
int tests = 1, CaseNo = 0;
long long ls[66], le[66], sz[66], cn[66], cv[66];
int findLevel(long long x) {
  for (int i = 0; i <= 60; ++i)
    if (ls[i] <= x and x <= le[i]) return i;
}
int solve() {
  for (int i = 0; i <= 60; ++i) {
    ls[i] = 1LL << i;
    le[i] = (1LL << (i + 1)) - 1;
    sz[i] = le[i] - ls[i] + 1;
  }
  int q;
  Int(q);
  while (q--) {
    int t;
    Int(t);
    if (t == 1) {
      long long x, k;
      Int(x, k);
      int lv = findLevel(x);
      cv[lv] = (cv[lv] + k) % sz[lv];
      cv[lv] = (cv[lv] + sz[lv]) % sz[lv];
    } else if (t == 2) {
      long long x, k;
      Int(x, k);
      int lv = findLevel(x);
      cn[lv] = (cn[lv] + k) % sz[lv];
      cn[lv] = (cn[lv] + sz[lv]) % sz[lv];
    } else {
      long long x;
      Int(x);
      int lv = findLevel(x);
      set<long long> res;
      res.insert(-x);
      long long ps = x - ls[lv] + 1;
      ps = (ps + cv[lv]) % sz[lv];
      ps = !ps ? sz[lv] : ps;
      x = ls[lv] + ps - 1;
      while (x > 0) {
        long long nx = x / 2LL;
        if (lv > 0) {
          long long ps, ncn;
          ps = nx - ls[lv - 1] + 1;
          ncn = x & 1 ? (cn[lv] + 1) / 2 : cn[lv] / 2;
          ps = (ps + ncn) % sz[lv - 1];
          if (!ps) ps = sz[lv - 1];
          nx = ls[lv - 1] + ps - 1;
          ps = (ps - cv[lv - 1] + sz[lv - 1]) % sz[lv - 1];
          if (!ps) ps = sz[lv - 1];
          res.insert(-(ls[lv - 1] + ps - 1));
        }
        x = nx, --lv;
      }
      res.insert(-1);
      for (long long x : res) printf("%lld ", -x);
      printf("\n");
    }
  }
  return 0;
}
int main() {
  while (tests--) {
    solve();
  }
  return 0;
}
