n = int(input()) assert 2 <= n <= 2 * 10 ** 5 h = list(map(int,input().split())) for i in range(n): assert 1 <= h[i] <= 10 ** 9 t = list(map(int,input().split())) for i in range(n): assert 1 <= t[i] <= 10 ** 9 q = int(input()) assert 1 <= q <= 2 * 10 ** 5 for i in range(q): a, b = map(int,input().split()) assert 1 <= a <= n assert 1 <= b <= n assert a != b