# import pypyjit # pypyjit.set_param("max_unroll_recursion=-1") from collections import * from functools import * from itertools import * from heapq import * import sys, math # sys.setrecursionlimit(10**4) # input = sys.stdin.readline N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) R = deque() L = deque() I = [0]*N for i,(a,b) in enumerate(zip(A,B)): if a