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.util.*;

import java.io.*;
import java.math.*;


import static java.lang.Math.*;

public class Solution implements Runnable {

	long mod1 = (long) 1e9 + 7;
	int mod2 = 998244353;

	public void solve() throws Exception {
		int n=sc.nextInt();
		int arr[][]=new int[n][2];
		int lr=0;
		int rl=0;
		for(int i=0;i<n;i++)
		{
			arr[i][0]=sc.nextInt();
			arr[i][1]=sc.nextInt();
			if(arr[i][0]>arr[i][1])
			{
				lr++;
			}
			else
			{
				rl++;
			}
		}
		int first[][]=new int[lr][3];
		int second[][]=new int[rl][3];
		int count1=0;
		int count2=0;
		for(int i=0;i<n;i++)
		{
			if(arr[i][0]>arr[i][1])
			{
				first[count1][0]=arr[i][0];
				first[count1][1]=arr[i][1];
				first[count1][2]=i;
			    count1++;
			}
			else
			{
				second[count2][0]=arr[i][0];
				second[count2][1]=arr[i][1];
				second[count2][2]=i;
			    count2++;
			}
		}
		
		Arrays.parallelSort(first,(a,b)->(a[1]-b[1]));
		Arrays.parallelSort(second,(a,b)->(b[1]-a[1]));
		int max1=1;
		int max2=1;
		int s1=0;
		int s2=0;
		count1=1;
		count2=1;
		for(int i=1;i<lr;i++)
		{
			if(first[i][0]>first[i-1][1])
			{
				count1++;
				if(count1>max1)
				{
					max1=count1;
					s1=i;
				}
			}
			else
				count1=1;
		}
		for(int i=1;i<rl;i++)
		{
			if(second[i][0]<second[i-1][1])
			{
				count2++;
				if(count2>max2)
				{
					max2=count2;
					s2=i;
				}
			}
			else count2=1;
		}
		ArrayList<Integer> aa=new ArrayList<>();
		if(max1>max2) {
			int temp=max1;
			while(temp!=0)
			{
				aa.add(first[s1][2]);
				s1--;
				temp--;
			}
		}
		else
		{
			int temp=max2;
			while(temp!=0)
			{
				aa.add(second[s2][2]);
				s2--;
				temp--;
			}
		}
		out.println(Math.max(max1, max2));
		for(int i=aa.size()-1;i>=0;i--)
		{
			out.print((aa.get(i)+1)+" ");
		}
		

	}

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

	static long ncr(int n, int r, long p) {
		if (r > n)
			return 0l;
		if (r > n - r)
			r = n - r;

		long C[] = new long[r + 1];

		C[0] = 1;

		for (int i = 1; i <= n; i++) {

			for (int j = Math.min(i, r); j > 0; j--)
				C[j] = (C[j] + C[j - 1]) % p;
		}
		return C[r] % p;
	}

	public long power(long x, long y, long p) {
		long res = 1;
		// out.println(x+" "+y);
		x = x % p;
		if (x == 0)
			return 0;

		while (y > 0) {
			if ((y & 1) == 1)
				res = (res * x) % p;
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}

	static Throwable uncaught;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable uncaught) {
			Solution.uncaught = uncaught;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", (1 << 26));
		thread.start();
		thread.join();
		if (Solution.uncaught != null) {
			throw Solution.uncaught;
		}
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

	public String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

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

	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

}