def main():
    n = int(input())

    points = [tuple(map(int, input().split())) for i in range(n)]

    is_efficient = [True for i in range(n)]
    for i in range(n - 1):
        if not is_efficient[i]:
            continue
        for j in range(i + 1, n):
            if not is_efficient[j]:
                continue
            if any([
                points[i][0] > points[j][0] and points[i][1] >= points[j][1] and points[i][2] >= points[j][2],
                points[i][0] >= points[j][0] and points[i][1] > points[j][1] and points[i][2] >= points[j][2],
                points[i][0] >= points[j][0] and points[i][1] >= points[j][1] and points[i][2] > points[j][2],
            ]):
                is_efficient[j] = False
            elif any([
                points[i][0] < points[j][0] and points[i][1] <= points[j][1] and points[i][2] <= points[j][2],
                points[i][0] <= points[j][0] and points[i][1] < points[j][1] and points[i][2] <= points[j][2],
                points[i][0] <= points[j][0] and points[i][1] <= points[j][1] and points[i][2] < points[j][2],
            ]):
                is_efficient[i] = False
                break

    for i in range(n):
        if is_efficient[i]:
            print(i + 1)


if __name__ == '__main__':
    main()