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>
#pragma GCC optimize(3)
using namespace std;
struct IO {
  char buf[(1 << 20)], *p1, *p2;
  char pbuf[(1 << 20)], *pp;
  IO() : p1(buf), p2(buf), pp(pbuf) {}
  ~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); }
  inline char gc() {
    if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, (1 << 20), stdin);
    return p1 == p2 ? ' ' : *p1++;
  }
  inline bool blank(char ch) {
    return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
  }
  template <class T>
  inline void read(T &x) {
    double tmp = 1;
    bool sign = 0;
    x = 0;
    char ch = gc();
    for (; !(ch >= '0' && ch <= '9'); ch = gc())
      if (ch == '-') sign = 1;
    for (; (ch >= '0' && ch <= '9'); ch = gc()) x = x * 10 + (ch - '0');
    if (ch == '.')
      for (ch = gc(); (ch >= '0' && ch <= '9'); ch = gc())
        tmp /= 10.0, x += tmp * (ch - '0');
    if (sign) x = -x;
  }
  inline void read(char *s) {
    char ch = gc();
    for (; blank(ch); ch = gc())
      ;
    for (; !blank(ch); ch = gc()) *s++ = ch;
    *s = 0;
  }
  inline void read(char &c) {
    for (c = gc(); blank(c); c = gc())
      ;
  }
  inline void push(const char &c) {
    if (pp - pbuf == (1 << 20)) fwrite(pbuf, 1, (1 << 20), stdout), pp = pbuf;
    *pp++ = c;
  }
  template <class T>
  inline void write(T x) {
    if (x < 0) x = -x, push('-');
    static T sta[35];
    T top = 0;
    do {
      sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) push(sta[--top] + '0');
  }
  template <class T>
  inline void write(T x, char lastChar) {
    write(x), push(lastChar);
  }
} io;
constexpr long long N = 1e5 + 5;
constexpr double eps = 1e-6;
long long n, k, m, d;
long long id[64];
long long v[64];
long long Q;
long long level(long long x) {
  long long ans = 0;
  while (x) {
    ans++;
    x >>= 1LL;
  }
  return ans;
}
signed main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  ;
  cin >> Q;
  while (Q--) {
    long long T;
    cin >> T;
    if (T == 1LL) {
      long long X, K;
      cin >> X >> K;
      long long l = level(X);
      long long M = (1LL << (l - 1LL));
      v[l] += K % M;
      v[l] %= M;
      if (v[l] < 0) v[l] += M;
    } else if (T == 2) {
      long long X, K;
      cin >> X >> K;
      long long l = level(X);
      while (l < 64) {
        long long M = (1LL << (l - 1LL));
        K %= M;
        v[l] += K % M;
        v[l] %= M;
        if (v[l] < 0) v[l] += M;
        id[l] += K % M;
        id[l] %= M;
        if (id[l] < 0) id[l] += M;
        l++;
        K *= 2;
      }
    } else {
      long long X;
      cin >> X;
      cout << X << " ";
      long long l = level(X);
      long long M = 1LL << (l - 1LL);
      X -= M;
      long long rawid = (X + v[l] + M) % M;
      long long nowid = (rawid + id[l] + M) % M;
      while (M + rawid != 1LL) {
        rawid = (M + rawid) >> 1LL;
        M >>= 1LL;
        l--;
        rawid -= M;
        cout << M + (rawid - v[l] + M) % M << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
