1. Abridged Problem Statement
You have N members, each with strength Si and beauty Bi. Two members “hate” each other if one is stronger but less beautiful, or weaker but more beautiful (ties in either coordinate also count). You must select the largest possible subset with no such hatred between any two. Output its size and the original indices of selected members (in any order).

2. Detailed Editorial
We model each member as a point (S, B). A “hate” pair is exactly a non-strict ordering conflict in these two coordinates: one point fails to strictly dominate the other in both. To avoid any hate, in the chosen subset the sequence of strengths and beauties must be consistently and strictly ordered—i.e., if you sort by strength, beauties must strictly increase. Our goal becomes finding the largest chain in the partial order (S₁ < S₂ and B₁ < B₂).

Key steps:
1. Sort all members by increasing strength S; if two members share the same S, place the one with higher beauty first. Sorting by B descending for equal S ensures that we never pick two members with equal S (because their B would go down, breaking strict increase).
2. Extract the sequence of beauties in this sorted order.
3. Compute the Longest Increasing Subsequence (LIS) on this beauty sequence. This yields the maximum number of members you can invite without any hate.
4. To reconstruct which members form this LIS, we store, for each element, the chain length it achieves (pos[i]) and then scan from the back, peeling off elements whose pos matches the current target length.

Complexities:
- Sorting: O(N log N)
- LIS via patience sorting + binary search: O(N log N)
- Reconstruction: O(N)

Overall: O(N log N), which is fast for N up to 100 000.

3. C++ Solution
```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n;
vector<array<int, 3>> a;

void read() {
    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i][0] >> a[i][1];
        a[i][2] = i + 1;
    }
}

void solve() {
    // - We want the largest subset that can be totally ordered with both
    //   strength and beauty strictly increasing (any two members where one
    //   dominates strictly in both coexist; ties in either coordinate make them
    //   hate each other). This is a longest strictly-increasing chain in 2D.
    //
    // - Sort by strength ascending, breaking ties by beauty descending so that
    //   equal-strength members can never be picked together in a strictly
    //   increasing beauty run. Then a standard O(n log n) longest strictly
    //   increasing subsequence on the beauty values gives the answer length,
    //   with pos[i] recording the chain length ending at element i.
    //
    // - Reconstruct by scanning from the back, peeling off elements whose pos
    //   matches the current target length, then reversing to restore order and
    //   printing their original indices.

    sort(a.begin(), a.end(), [&](auto x, auto y) {
        if(x[0] != y[0]) {
            return x[0] < y[0];
        }
        return x[1] > y[1];
    });

    vector<int> lis;
    vector<int> pos(n, -1);
    for(int i = 0; i < n; i++) {
        auto it = lower_bound(lis.begin(), lis.end(), a[i][1]);
        pos[i] = it - lis.begin();
        if(it == lis.end()) {
            lis.push_back(a[i][1]);
        } else {
            *it = a[i][1];
        }
    }

    int len = lis.size();
    vector<int> ans;
    for(int i = n - 1; i >= 0; i--) {
        if(pos[i] == len - 1) {
            ans.push_back(a[i][2]);
            len--;
        }
    }

    reverse(ans.begin(), ans.end());
    cout << ans.size() << '\n';
    cout << ans << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}
```

4. Python Solution with Detailed Comments
```python
import sys
import bisect

def main():
    input = sys.stdin.readline
    n = int(input())
    members = []
    for i in range(n):
        s, b = map(int, input().split())
        members.append((s, b, i+1))  # store 1-based index

    # 1) Sort by strength asc, beauty desc when strengths tie
    members.sort(key=lambda x: (x[0], -x[1]))

    # Arrays for LIS
    lis = []          # will store tail beauties
    lis_idx = []      # will store which member index ends that LIS length
    prev = [-1] * n   # back-pointer to reconstruct path

    # 2) Build LIS on beauty dimension
    for i, (s, b, orig) in enumerate(members):
        # find place in lis for b
        pos = bisect.bisect_left(lis, b)
        if pos == len(lis):
            # extending the LIS
            lis.append(b)
            lis_idx.append(i)
        else:
            # replace to get smaller tail
            lis[pos] = b
            lis_idx[pos] = i

        # set back-pointer: if pos > 0, link to end of previous length
        if pos > 0:
            prev[i] = lis_idx[pos-1]
        else:
            prev[i] = -1

    # 3) Reconstruct the LIS sequence of original indices
    length = len(lis)
    seq = []
    # start from the last index in lis_idx
    idx = lis_idx[-1]
    while idx != -1:
        seq.append(members[idx][2])  # original index
        idx = prev[idx]
    seq.reverse()

    # 4) Output
    print(len(seq))
    print(*seq)

if __name__ == "__main__":
    main()
```

5. Compressed Editorial
- Model members as points (S, B).
- Hate = ordering conflict in (S, B). Select largest subset avoiding conflicts ⇒ find maximum chain with S and B both strictly increasing.
- Sort by S↑, B↓ (to handle equal S). Extract beauty sequence.
- Compute LIS on beauties in O(N log N), tracking the chain length pos[i] of each element.
- Reconstruct by a backward scan over pos[], then output the LIS length and the corresponding original indices.
