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 PYTHON3):

Solution:
import os
import heapq
import sys
import math
import bisect
import operator
from collections import defaultdict
from io import BytesIO, IOBase
def gcd(a,b):
    if b==0:

        return a
    else:
        return gcd(b,a%b)
def power(x, p,m):
    res = 1
    while p:
        if p & 1:
            res = (res * x) % m
        x = (x * x) % m
        p >>= 1
    return res
def inar():
    return [int(k) for k in input().split()]


# def bubbleSort(arr,b):
#     n = len(arr)
#     for i in range(n):
#         for j in range(0, n - i - 1):
#             if arr[j] > arr[j + 1] and b[j]!=b[j+1]:
#                 arr[j], arr[j + 1] = arr[j + 1], arr[j]
#                 b[j],b[j+1]=b[j+1],b[j]
def lcm(num1,num2):
    return (num1*num2)//gcd(num1,num2)
def binaryToDecimal(n):
    return int(n,2)

def main():
    # n = int(input())
    # arr = [int(el) for el in input().split()]
    # i = 0
    # res = []
    # while i < n:
    #     # print(i)
    #     # print(*arr)
    #     if arr[i] - 1 == i:
    #         i += 1
    #     else:
    #         pos2 = arr[i] - 1
    #         if abs(pos2 - i) >= (n // 2):
    #             res.append([min(i + 1, pos2 + 1), max(i + 1, pos2 + 1)])
    #             temp = arr[i]
    #             arr[i] = arr[pos2]
    #             arr[pos2] = temp
    #         elif i < (n // 2) and pos2 < (n // 2):
    #             res.append([i + 1, n])
    #             res.append([pos2 + 1, n])
    #             res.append([i + 1, n])
    #             temp = arr[i]
    #             arr[i] = arr[pos2]
    #             arr[pos2] = temp
    #         elif i < n // 2 <= pos2:
    #             res.append([i + 1, n])
    #             res.append([1, pos2 + 1])
    #             res.append([1, n])
    #             res.append([1, pos2 + 1])
    #             res.append([i + 1, n])
    #             temp = arr[i]
    #             arr[i] = arr[pos2]
    #             arr[pos2] = temp
    #         else:
    #             res.append([1, i + 1])
    #             res.append([1, pos2 + 1])
    #             res.append([1, i + 1])
    #             temp = arr[i]
    #             arr[i] = arr[pos2]
    #             arr[pos2] = temp
    # print(len(res))
    # for i in range(len(res)):
    #     print(*res[i])
    n = int(input())
    pair1 = []
    pair2=[]
    for i in range (n):
        a,b = map(int, input().split())
        if a<b:
            pair1.append([a,b,i+1])
        else:
            pair2.append([a,b,i+1])
    if len(pair1)>len(pair2):
        pair1=sorted(pair1,key=lambda x:(-x[0]))
        print(len(pair1))
        for i in range(len(pair1)):
            print(pair1[i][2],end=" ")
        print()
    else:
        pair2=sorted(pair2,key=lambda x:(x[1]))
        print(len(pair2))
        for i in range(len(pair2)):
            print(pair2[i][2],end=" ")
        print()









BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()