Problem: You are given n pairs of integers (a_1, b_1), (a_2, b_2), …, (a_n, b_n). All of the integers in the pairs are distinct and are in the range from 1 to 2 ⋅ n inclusive.

Let's call a sequence of integers x_1, x_2, …, x_{2k} good if either 

  * x_1 < x_2 > x_3 < … < x_{2k-2} > x_{2k-1} < x_{2k}, or 
  * x_1 > x_2 < x_3 > … > x_{2k-2} < x_{2k-1} > x_{2k}. 



You need to choose a subset of distinct indices i_1, i_2, …, i_t and their order in a way that if you write down all numbers from the pairs in a single sequence (the sequence would be a_{i_1}, b_{i_1}, a_{i_2}, b_{i_2}, …, a_{i_t}, b_{i_t}), this sequence is good.

What is the largest subset of indices you can choose? You also need to construct the corresponding index sequence i_1, i_2, …, i_t.

Input

The first line contains single integer n (2 ≤ n ≤ 3 ⋅ 10^5) — the number of pairs.

Each of the next n lines contain two numbers — a_i and b_i (1 ≤ a_i, b_i ≤ 2 ⋅ n) — the elements of the pairs.

It is guaranteed that all integers in the pairs are distinct, that is, every integer from 1 to 2 ⋅ n is mentioned exactly once.

Output

In the first line print a single integer t — the number of pairs in the answer.

Then print t distinct integers i_1, i_2, …, i_t — the indexes of pairs in the corresponding order.

Examples

Input


5
1 7
6 4
2 10
9 8
3 5


Output


3
1 5 3


Input


3
5 4
3 2
6 1


Output


3
3 2 1

Note

The final sequence in the first example is 1 < 7 > 3 < 5 > 2 < 10.

The final sequence in the second example is 6 > 1 < 3 > 2 < 5 > 4.

Solution (in JAVA):

Solution:



    import java.io.*;
    import java.util.*;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.util.Collections;
    import java.io.InputStreamReader;
    import static java.lang.Math.*;
    import static java.lang.System.*;

    public class Main1 {

        static  class pair implements  Comparable<pair> {
            int a , b , c ;
            pair(int a, int b , int c){
                this.a = a;
                this.b = b ;
                this.c = c ;
            }
            @Override
            public int compareTo(pair o) {
                return this.a - o.a ;
            }
        }

        static  class pair1 implements  Comparable<pair1> {
            int a , b , c ;
            pair1(int a, int b , int c){
                this.a = a;
                this.b = b ;
                this.c = c ;
            }
            @Override
            public int compareTo(pair1 o) {
                return -this.b + o.b ;
            }
        }





        public static void main(String[] args) throws IOException {

    //       try {
           // Scanner in = new Scanner(System.in) ;
             FastScanner in = new FastScanner();
           PrintWriter out = new PrintWriter(System.out);


           int n = in.nextInt() ;
           ArrayList<pair> list1 = new ArrayList<>() ;
           ArrayList<pair1> list2 = new ArrayList<>() ;

            for (int i = 0; i <n ; i++) {
                int a = in.nextInt() ;
                int b = in.nextInt() ;
                if (a > b)list1.add(new pair(a , b , i+1)) ;
                else list2.add(new pair1(a , b , i+1)) ;

            }
            Collections.sort(list1);
            Collections.sort(list2);

            if (list1.size() > list2.size()){
                out.append(list1.size() + "\n") ;
                for (int i = 0; i <list1.size() ; i++) {
                    out.append(list1.get(i).c + " ") ;
                }
            }
            else {
                out.append(list2.size() + "\n") ;
                for (int i = 0; i <list2.size() ; i++) {
                    out.append(list2.get(i).c + " ") ;
                }
            }









            



            out.flush();
            out.close();

        }
    //        catch (Exception e){
    //            return;
    //        }
    //
    //    }

        static long gcd(long a, long b) {
            return (b == 0) ? a : gcd(b, a % b);
        }

        static int gcd(int a, int b) {
            return (b == 0) ? a : gcd(b, a % b);
        }

        static void sort(int ar[]) {
            int n = ar.length;
            ArrayList<Integer> a = new ArrayList<>();
            for (int i = 0; i < n; i++)
                a.add(ar[i]);
            Collections.sort(a);
            for (int i = 0; i < n; i++)
                ar[i] = a.get(i);
        }

        static void sort1(long ar[]) {
            int n = ar.length;
            ArrayList<Long> a = new ArrayList<>();
            for (int i = 0; i < n; i++)
                a.add(ar[i]);
            Collections.sort(a);
            for (int i = 0; i < n; i++)
                ar[i] = a.get(i);
        }

        static long ncr(long n, long r, long mod) {
            if (r == 0)
                return 1;
            long val = ncr(n - 1, r - 1, mod);
            val = (n * val) % mod;
            val = (val * modInverse(r, mod)) % mod;
            return val;
        }

        static long fast_pow(long base, long n, long M) {
            if (n == 0)
                return 1;
            if (n == 1)
                return base % M;
            long halfn = fast_pow(base, n / 2, M);
            if (n % 2 == 0)
                return (halfn * halfn) % M;
            else
                return (((halfn * halfn) % M) * base) % M;
        }

        static long modInverse(long n, long M) {
            return fast_pow(n, M - 2, M);
        }

    // ======================================================================================================



        static class FastOutput implements AutoCloseable, Closeable, Appendable {
            private static final int THRESHOLD = 32 << 10;
            private final Writer os;
            private StringBuilder cache = new StringBuilder(THRESHOLD * 2);

            public FastOutput append(CharSequence csq) {
                cache.append(csq);
                return this;
            }

            public FastOutput append(CharSequence csq, int start, int end) {
                cache.append(csq, start, end);
                return this;
            }

            private void afterWrite() {
                if (cache.length() < THRESHOLD) {
                    return;
                }
                flush();
            }

            public FastOutput(Writer os) {
                this.os = os;
            }

            public FastOutput(OutputStream os) {
                this(new OutputStreamWriter(os));
            }

            public FastOutput append(char c) {
                cache.append(c);
                afterWrite();
                return this;
            }

            public FastOutput append(long c) {
                cache.append(c);
                afterWrite();
                return this;
            }

            public FastOutput append(String c) {
                cache.append(c);
                afterWrite();
                return this;
            }

            public FastOutput println() {
                return append(System.lineSeparator());
            }

            public FastOutput flush() {
                try {
                    //            boolean success = false;
                    //            if (stringBuilderValueField != null) {
                    //                try {
                    //                    char[] value = (char[]) stringBuilderValueField.get(cache);
                    //                    os.write(value, 0, cache.length());
                    //                    success = true;
                    //                } catch (Exception e) {
                    //                }
                    //            }
                    //            if (!success) {
                    os.append(cache);
                    //            }
                    os.flush();
                    cache.setLength(0);
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
                return this;
            }

            public void close() {
                flush();
                try {
                    os.close();
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }

            public String toString() {
                return cache.toString();
            }

        }


        static class FastScanner {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            StringTokenizer st = new StringTokenizer("");

            String next() {
                while (!st.hasMoreTokens())
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                return st.nextToken();
            }

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

            int[] readArray(int n) {
                int[] a = new int[n];
                for (int i = 0; i < n; i++) a[i] = nextInt();
                return a;
            }


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


    }