#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int mxN = 2e5 + 5;
pair <pair<int, int>, int> a[mxN];
pair <int, int> x[mxN], y[mxN], z[mxN];
int main() {
int n;
scanf("%d", &n);
for(int i = 1; i <= n; ++i) {
scanf("%d%d%d", &a[i].first.first, &a[i].first.second, &a[i].second);
x[i] = make_pair(a[i].first.first, i);
y[i] = make_pair(a[i].first.second, i);
z[i] = make_pair(a[i].second, i);
}
sort(x + 1, x + n + 1);
sort(y + 1, y + n + 1);
sort(z + 1, z + n + 1);
vector <int> answer;
for(int i = 1; i <= n; ++i) {
int First = a[i].first.first;
int Second = a[i].first.second;
int Third = a[i].second;
int look;
bool can = false;
int idx = -1;
if(x[1].second == i) {
idx = x[2].second;
look = x[2].first;
}
else {
idx = x[1].second;
look = x[1].first;
}
if(First > look)
can |= (Second > a[idx].first.second || Third > a[idx].second);
if(y[1].second == i) {
idx = y[2].second;
look = y[2].first;
}
else {
idx = y[1].second;
look = y[1].first;
}
if(Second > look)
can |= (First > a[idx].first.first || Third > a[idx].second);
if(z[1].first > look) {
idx = z[2].second;
look = z[2].first;
}
else {
idx = z[1].second;
look = z[1].first;
}
can |= (Second > a[idx].first.second || First > a[idx].first.first);
if(!can)
answer.push_back(i);
}
printf("%d\n", (int)answer.size());
for(int &cur : answer)
printf("%d ", cur);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IG14TiA9IDJlNSArIDU7CnBhaXIgPHBhaXI8aW50LCBpbnQ+LCBpbnQ+IGFbbXhOXTsKcGFpciA8aW50LCBpbnQ+IHhbbXhOXSwgeVtteE5dLCB6W214Tl07CgppbnQgbWFpbigpIHsKCWludCBuOwoJc2NhbmYoIiVkIiwgJm4pOwoJZm9yKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKCQlzY2FuZigiJWQlZ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