import java.util.*; import java.io.*; import java.math.*; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(); int N = sc.nextInt(); int[] P = new int[N]; int[] T = new int[N]; int[] R = new int[N]; int[][] a = new int[N][]; for (int i = 0; i < N; ++i) { P[i] = sc.nextInt(); T[i] = sc.nextInt(); R[i] = sc.nextInt(); a[i] = new int[] { P[i], T[i], R[i], i }; } Arrays.sort(a, new Comparator() { public int compare(int[] o1, int[] o2) { if (o1[0] != o2[0]) { return -Integer.compare(o1[0], o2[0]); } else if (o1[1] != o2[1]) { return -Integer.compare(o1[1], o2[1]); } else { return -Integer.compare(o1[2], o2[2]); } } }); boolean[] ok = new boolean[N]; Arrays.fill(ok, true); RMQ rmq = new RMQ(10000 + 1); for (int i = 0; i < N; ++i) { if (rmq.query(a[i][1], 10000 + 1) >= a[i][2]) { ok[a[i][3]] = false; } rmq.update(a[i][1], a[i][2]); } for (int i = 0; i < N; ++i) { if (ok[i]) System.out.println(i + 1); } } class RMQ { int n; int[] v; public RMQ(int n_) { n = 1; while (n < n_) n *= 2; v = new int[2 * n - 1]; Arrays.fill(v, -1); } void update(int k, int val) { k += n - 1; v[k] = Math.max(v[k], val); while (k > 0) { k = (k - 1) / 2; v[k] = Math.max(v[2 * k + 1], v[2 * k + 2]); } } int query(int a, int b) { return query(a, b, 0, n, 0); } int query(int a, int b, int l, int r, int k) { if (a <= l && r <= b) return v[k]; else if (b <= l || r <= a) return -1; else { int vl = query(a, b, l, (l + r) / 2, 2 * k + 1); int vr = query(a, b, (l + r) / 2, r, 2 * k + 2); return Math.max(vl, vr); } } } void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } } class Scanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { return (int) nextLong(); } }