<gh_stars>0
'''
        Problem Statement : Chef and The Lockdown
        Link : https://www.codechef.com/WNTR2020/problems/WC01
        Score : accepted
'''

N = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
timings = []
for i in range(N):
        timings.append([l1[i],l2[i]])

#timings = sorted(timings, key=lambda x :x[0])

end = timings[0][1]
tasks = [0]
for i in range(1,len(timings)):
        if(timings[i][0]>=end):
                end = timings[i][1]
                tasks.append(i)

print(*tasks)

'''
        Problem Statement : Chef and The Lockdown
        Link : https://www.codechef.com/WNTR2020/problems/WC01
        Score : accepted
'''

N = int(input())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
timings = []
for i in range(N):
        timings.append([l1[i],l2[i]])

#timings = sorted(timings, key=lambda x :x[0])

end = timings[0][1]
tasks = [0]
for i in range(1,len(timings)):
        if(timings[i][0]>=end):
                end = timings[i][1]
                tasks.append(i)

print(*tasks)
Problem Statement : Chef and The Lockdown         Link : https://www.codechef.com/WNTR2020/problems/WC01         Score : accepted #timings = sorted(timings, key=lambda x :x[0])