Problem: Johnny's younger sister Megan had a birthday recently. Her brother has bought her a box signed as "Your beautiful necklace — do it yourself!". It contains many necklace parts and some magic glue. 

The necklace part is a chain connecting two pearls. Color of each pearl can be defined by a non-negative integer. The magic glue allows Megan to merge two pearls (possibly from the same necklace part) into one. The beauty of a connection of pearls in colors u and v is defined as follows: let 2^k be the greatest power of two dividing u ⊕ v — [exclusive or](https://en.wikipedia.org/wiki/Exclusive_or#Computer_science) of u and v. Then the beauty equals k. If u = v, you may assume that beauty is equal to 20.

Each pearl can be combined with another at most once. Merging two parts of a necklace connects them. Using the glue multiple times, Megan can finally build the necklace, which is a cycle made from connected necklace parts (so every pearl in the necklace is combined with precisely one other pearl in it). The beauty of such a necklace is the minimum beauty of a single connection in it. The girl wants to use all available necklace parts to build exactly one necklace consisting of all of them with the largest possible beauty. Help her!

Input

The first line contains n (1 ≤ n ≤ 5 ⋅ 10^5) — the number of necklace parts in the box. Each of the next n lines contains two integers a and b (0 ≤ a, b < 2^{20}), which denote colors of pearls presented in the necklace parts. Pearls in the i-th line have indices 2i - 1 and 2i respectively.

Output

The first line should contain a single integer b denoting the maximum possible beauty of a necklace built from all given parts.

The following line should contain 2n distinct integers p_i (1 ≤ p_i ≤ 2n) — the indices of initial pearls in the order in which they appear on a cycle. Indices of pearls belonging to the same necklace part have to appear at neighboring positions in this permutation (so 1 4 3 2 is not a valid output, whereas 2 1 4 3 and 4 3 1 2 are). If there are many possible answers, you can print any.

Examples

Input


5
13 11
11 1
3 5
17 1
9 27


Output


3
8 7 9 10 5 6 1 2 3 4 


Input


5
13 11
11 1
3 5
17 1
7 29


Output


2
8 7 10 9 5 6 4 3 2 1 


Input


1
1 1


Output


20
2 1 

Note

In the first example the following pairs of pearls are combined: (7, 9), (10, 5), (6, 1), (2, 3) and (4, 8). The beauties of connections equal correspondingly: 3, 3, 3, 20, 20.

The following drawing shows this construction.

<image>

Solution (in JAVA):

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

public class Main {
    //SOLUTION BEGIN
    //Into the Hardware Mode
    long MOD = (long)1e9+7;
    void pre() throws Exception{}
    void solve(int TC) throws Exception {
        int M = ni();
        int[] from = new int[M], to = new int[M];
        for(int i = 0; i< M; i++){
            from[i] = ni();
            to[i] = ni();
        }
        int lo = 0, hi = 20;
        while(lo+1 < hi){
            int mid = (lo+hi)/2;
            if(check(M, from, to, mid))lo = mid;
            else hi = mid;
        }
        if(check(M, from, to, hi))lo = hi;
        pn(lo);
        int N = 1<<lo;
        int mask = (1<<lo)-1;
        LinkedList<int[]>[] list = new LinkedList[N];
        for(int i = 0; i< N; i++)
            list[i] = new LinkedList<>();
        for(int i = 0; i< M; i++){
            from[i] &= mask;
            to[i] &= mask;
            list[from[i]].add(new int[]{to[i], i, 0});
            list[to[i]].add(new int[]{from[i], i, 1});
        }

        Deque<int[]> q = new LinkedList<>();
        int st = from[0];
        boolean[] added = new boolean[M];
        dfs(q, list, added, st, st);
        while(q.size() < M){
            q.addFirst(q.pollLast());
            int[] e = q.peekLast();
            int u = to[e[0]];
            if(e[1] == 1)u = from[e[0]];
            if(list[u].size() > 0)dfs(q, list, added, u, u);
        }
        int[] ans = new int[2*M];
        for(int i = 0; i< M; i++){
            int[] e = q.pollFirst();
            ans[i<<1] = ans[i<<1|1] = e[0]*2;
            if(e[1] == 1)ans[i<<1] |= 1;
            else ans[i<<1|1] |= 1;
        }
        for(int i:ans)p(1+i+" ");pn("");
    }
    void dfs(Deque<int[]> q, LinkedList<int[]>[] list, boolean[] added, int u, int st){
        Iterator<int[]> it = list[u].iterator();
        int nxt = -1;
        while(it.hasNext()){
            int[] e = it.next();
            it.remove();
            if(added[e[1]])continue;
            added[e[1]] = true;
            q.add(new int[]{e[1], e[2]});
            if(e[0] != st)nxt = e[0];
            break;
        }
        if(nxt != -1)dfs(q, list, added, nxt, st);
    }
    boolean check(int N, int[] from, int[] to, int b){
        int[] f = new int[1<<b];
        int mask = (1<<b)-1;
        for(int i:from)f[mask&i]++;
        for(int i:to)f[mask&i]++;
        int[] set = new int[1<<b];
        for(int i = 0; i< 1<<b; i++)set[i] = i;
        for(int i = 0; i< N; i++)
            set[find(set, to[i]&mask)] = find(set, from[i]&mask);
        int root = 0;
        for(int i = 0; i< 1<<b; i++){
            if(f[i] > 0)root = i;
        }
        for(int i = 0; i< 1<<b; i++){
            if(f[i] > 0 && find(set, i) != find(set, root))return false;
        }
        for(int i:f)if(i%2 == 1)return false;
        return true;
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    static void debug(Object... o){System.err.println(Arrays.deepToString(o));}
    final long IINF = (long)2e18;
    final int INF = (int)1e9+2;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = false, memory = true, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = multipleTC? ni():1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis() - ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    int[][] make(int n, int e, int[] from, int[] to, boolean f){
        int[][] g = new int[n][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = to[i];
            if(f)g[to[i]][--cnt[to[i]]] = from[i];
        }
        return g;
    }
    int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){
        int[][][] g = new int[n][][];int[]cnt = new int[n];
        for(int i = 0; i< e; i++){
            cnt[from[i]]++;
            if(f)cnt[to[i]]++;
        }
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];
        for(int i = 0; i< e; i++){
            g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};
            if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};
        }
        return g;
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}