import sys input = sys.stdin.buffer.readline MAX = 10 ** 4 + 1 class Bit: """1-indexed""" def __init__(self, n): self.size = n self.tree = [MAX] * (n + 1) def min(self, i): m = MAX while i > 0: m = min(m, self.tree[i]) i -= i & -i return m def update(self, i, x): while i <= self.size: self.tree[i] = min(x, self.tree[i]) i += i & -i N = int(input()) stores = [] for i in range(1, N + 1): p, t, r = map(int, input().split()) stores.append((MAX - p, MAX - t, MAX - r, i)) stores.sort() BIT = Bit(MAX) ans = [] for _, t, r, i in stores: if BIT.min(t) >= r: BIT.update(t, r) ans.append(i) ans.sort() print(*ans, sep='\n')