Problem: 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>

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

/*
TASK: CFD
LANG: JAVA
 */
public class CFD {
    static long q , t , x , k;
    static int n , lv;
    static long[] inc;

    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        n = 60;
        q = in.nextInt();
        inc = new long[n];
        for(int i = 0;i < n; i++)inc[i] = 0;
        for(int i = 0;i < q; i++){
            t = in.nextInt();
            x = in.nextLong();
            lv = Long.numberOfTrailingZeros(Long.highestOneBit(x));
            if(t < 3) k = in.nextLong();
            if(t == 1){
                inc[lv] += k;
                inc[lv] %= ((long)1 << lv);
                inc[lv] += ((long)1 << lv);
                inc[lv] %= ((long)1 << lv);
            }
            else if(t == 2){
                for(int j = lv; j < 60; j++){
                    inc[j] += k;
                    inc[j] %= ((long)1 << j);
                    inc[j] += ((long)1 << j);
                    inc[j] %= ((long)1 << j);
                    k *= 2;
                    k %= ((long)1 << 60);
                }
            }
            else {
                StringBuilder output = new StringBuilder(x + " ");
                k = (x - ((long)1 << lv));
                k += inc[lv];
                k %= ((long)1 << lv);
                for(int j = lv-1; j >= 0; j--){
                    k /= 2;
                    output.append(((((k - inc[j]) % ((long)1 << j)) + ((long)1 << j)) % ((long)1 << j)) + ((long)1 << j)   + " ");
                }
                System.out.println(output);
            }
        }
    }

    private static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        boolean isEndline(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isEndline(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndline(c));
            return res.toString();
        }
    }
}