#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long n) {
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
vector<long long> fact(long long n) {
  vector<long long> ans;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long ct = 0;
      while (n % i == 0) {
        ct++;
        n /= i;
        ans.push_back(i);
      }
    }
  }
  if (n > 1) {
    ans.push_back(n);
  }
  return ans;
}
inline long long getPow(long long a, long long b) {
  long long res = 1ll, tp = a;
  while (b) {
    if (b & 1ll) {
      res *= tp;
      res %= 125;
    }
    tp *= tp;
    tp %= 125;
    b >>= 1ll;
  }
  return res;
}
long long vec_mult(long long x1, long long y1, long long x2, long long y2,
                   long long x3, long long y3) {
  return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
}
void ok() {
  cout << "YES" << endl;
  exit(0);
}
void no() {
  cout << "NO" << endl;
  exit(0);
}
inline long long nxt() {
  long long x;
  cin >> x;
  return x;
}
const long long N = 2e5 + 5, inf = 9e18;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
struct huita {
  int l, r, id;
  huita(long long l, long long r, long long id) {
    this->l = l;
    this->r = r;
    this->id = id;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n = nxt();
  vector<huita> a;
  vector<huita> b;
  for (int i = 0; i < n; i++) {
    long long l = nxt(), r = nxt();
    if (r > l)
      a.push_back(huita(l, r, i));
    else
      b.push_back(huita(l, r, i));
  }
  if (a.size() > b.size()) {
    cout << a.size() << endl;
    sort(a.begin(), a.end(),
         [](const huita& t1, const huita& t2) { return t1.l > t2.l; });
    for (auto x : a) {
      cout << x.id + 1 << " ";
    }
  } else {
    cout << b.size() << endl;
    sort(b.begin(), b.end(),
         [](const huita& t1, const huita& t2) { return t1.l < t2.l; });
    for (auto x : b) {
      cout << x.id + 1 << " ";
    }
  }
  return 0;
}

### Prompt

Please formulate a Cpp solution to the following 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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long n) {
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
vector<long long> fact(long long n) {
  vector<long long> ans;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      long long ct = 0;
      while (n % i == 0) {
        ct++;
        n /= i;
        ans.push_back(i);
      }
    }
  }
  if (n > 1) {
    ans.push_back(n);
  }
  return ans;
}
inline long long getPow(long long a, long long b) {
  long long res = 1ll, tp = a;
  while (b) {
    if (b & 1ll) {
      res *= tp;
      res %= 125;
    }
    tp *= tp;
    tp %= 125;
    b >>= 1ll;
  }
  return res;
}
long long vec_mult(long long x1, long long y1, long long x2, long long y2,
                   long long x3, long long y3) {
  return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
}
void ok() {
  cout << "YES" << endl;
  exit(0);
}
void no() {
  cout << "NO" << endl;
  exit(0);
}
inline long long nxt() {
  long long x;
  cin >> x;
  return x;
}
const long long N = 2e5 + 5, inf = 9e18;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
struct huita {
  int l, r, id;
  huita(long long l, long long r, long long id) {
    this->l = l;
    this->r = r;
    this->id = id;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n = nxt();
  vector<huita> a;
  vector<huita> b;
  for (int i = 0; i < n; i++) {
    long long l = nxt(), r = nxt();
    if (r > l)
      a.push_back(huita(l, r, i));
    else
      b.push_back(huita(l, r, i));
  }
  if (a.size() > b.size()) {
    cout << a.size() << endl;
    sort(a.begin(), a.end(),
         [](const huita& t1, const huita& t2) { return t1.l > t2.l; });
    for (auto x : a) {
      cout << x.id + 1 << " ";
    }
  } else {
    cout << b.size() << endl;
    sort(b.begin(), b.end(),
         [](const huita& t1, const huita& t2) { return t1.l < t2.l; });
    for (auto x : b) {
      cout << x.id + 1 << " ";
    }
  }
  return 0;
}

```