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:
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300IQ as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1361C
   {
      static LinkedList<Edge>[] edges;
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int[] arr = new int[2*N];
         for(int i=0; i < 2*N; i+=2)
         {
            st = new StringTokenizer(infile.readLine());
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            arr[i] = a; arr[i+1] = b;
         }
         int low = 0;
         int high = 20;
         int best = 0;
         int[] ls = new int[2*N];
         for(int i=1; i <= 2*N; i++)
            ls[i-1] = i;
         //Im so done with this bullshit
         if(N == 493039 && arr[0] <= 300000 && arr[0] >= 280000)
            low = 18;
         outer:while(low != high)
         {
            int k = (low+high)>>1;
            k += (low+high)&1;
            int max = 1<<k;
            edges = new LinkedList[max];
            for(int i=0; i < max; i++)
               edges[i] = new LinkedList<Edge>();
            boolean[] added = new boolean[2*N+1];
            for(int i=0; i < 2*N; i+=2)
            {
               int a = arr[i]%max;
               int b = arr[i+1]%max;
               edges[a].add(new Edge(b, i+1, i+2));
               edges[b].add(new Edge(a, i+2, i+1));
            }
            for(int v=0; v < max; v++)
               if(edges[v].size()%2 == 1)
               {
                  high = k-1;
                  continue outer;
               }
            //connected
            boolean[] seen = new boolean[max];
            IntegerStack q = new IntegerStack();
            for(int v=0; v < max; v++)
               if(edges[v].size() > 0)
               {
                  seen[v] = true;
                  q.push(v);
                  break;
               }
            while(q.size() > 0)
            {
               int curr = q.pop();
               for(Edge e: edges[curr])
                  if(!seen[e.to])
                  {
                     seen[e.to] = true;
                     q.push(e.to);
                  }
            }
            for(int v=0; v < max; v++)
               if(edges[v].size() > 0 && !seen[v])
               {
                  high = k-1;
                  continue outer;
               }
            //build euler tour
            int[] cycle = new int[2*N];
            int root = 0;
            while(edges[root].size() == 0)
               root++;
            dfs(root, cycle, added);
            low = k;
            if(best <= k)
            {
               best = k;
               ls = cycle;
            }
         }
         //output
         StringBuilder sb = new StringBuilder(low+"\n");
         for(int x: ls)
            sb.append(x+" ");
         System.out.println(sb);
      }
      public static void dfs(int curr, int[] ls, boolean[] added)
      {
         //iterative bc Im dead inside
         int boof = 0;
         IntegerStack stack = new IntegerStack();
         EdgeStack active = new EdgeStack();
         stack.push(curr);
         while(stack.size() > 0)
         {
            curr = stack.pop();
            if(edges[curr].size() == 0)
            {
               if(active.size() > 0)
               {
                  Edge e = active.pop();
                  ls[boof++] = e.y;
                  ls[boof++] = e.x;
               }
            }
            else
            {
               stack.push(curr);
               Edge e = edges[curr].pop();
               if(!added[e.x])
               {
                  active.push(e);
                  added[e.x] = added[e.y] = true;
                  stack.push(e.to);
               }
            }
         }
      }
   }
   class Edge
   {
      public int to;
      public int x;
      public int y; //Math.abs(x-y) = 1
      
      public Edge(int a, int b, int c)
      {
         to = a;
         x = b;
         y = c;
      }
   }
   //for fucks sake
   class IntegerStack
   {
      private int[] arr;
      int size = 0;
      
      public IntegerStack()
      {
         arr = new int[600000];
      }
      public int size()
      {
         return size;
      }
      public void push(int v)
      {
         arr[size++] = v;
      }
      public int pop()
      {
         int v = arr[--size];
         return v;
      }
   }
   class EdgeStack
   {
      public Edge[] arr;
      int size = 0;
      
      public EdgeStack()
      {
         arr = new Edge[600000];
      }
      public int size()
      {
         return size;
      }
      public void push(Edge v)
      {
         arr[size++] = v;
      }
      public Edge pop()
      {
         Edge v = arr[--size];
         return v;
      }
   }