import sys sys.setrecursionlimit(10**6) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.buffer.readline()) def MI(): return map(int, sys.stdin.buffer.readline().split()) def MI1(): return map(int1, sys.stdin.buffer.readline().split()) def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def LI1(): return list(map(int1, sys.stdin.buffer.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def BI(): return sys.stdin.buffer.readline().rstrip() def SI(): return sys.stdin.buffer.readline().rstrip().decode() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [[(-1, 0), (1, 0)], [(0, -1), (0, 1)]] inf = 10**16 # md = 998244353 md = 10**9+7 class BitMax: def __init__(self, n): self.inf=10**9 self.n = n + 3 self.table = [-self.inf] * (self.n + 1) def update(self, i, x): i += 1 while i <= self.n: if x > self.table[i]: self.table[i] = x i += i & -i def max(self, i): i += 1 res = -self.inf while i > 0: if self.table[i] > res: res = self.table[i] i -= i & -i return res mx=10005 bit=BitMax(mx) n=II() xyz=LLI(n) xyzi=[(x,y,z,i+1) for i,(x,y,z) in enumerate(xyz)] xyzi.sort(reverse=True) ans=[] for x,y,z,i in xyzi: y=mx-y pz=bit.max(y) if z>pz: ans.append(i) bit.update(y,z) ans.sort() print(*ans,sep="\n")