P10208 [JOI 2024 Final] Gift Exchange / Gift Exchange

Description

There are $N$ students at JOI Academy, and each student has an ID number from $1$ to $N$. JOI Academy is planning to hold a gift exchange party soon. Each student will bring one gift to the venue, and the value of the gift brought by student $i\ (1 \leq i \leq N)$ is $A_{i}$. Students do not like to receive a gift whose value is much lower than the one they brought. More specifically, student $i$ will be dissatisfied if they receive a gift with value less than $B_{i}$. It is guaranteed that $B_{i}

Input Format

The first line contains an integer $N$. The second line contains $N$ space-separated integers $A_1,A_2,\ldots ,A_N$. The third line contains $N$ space-separated integers $B_1,B_2,\ldots ,B_N$. The fourth line contains an integer $Q$. Each of the next $Q$ lines contains two integers $L_i,R_i$.

Output Format

Output $Q$ lines. On the $j\ (1 \leq j \leq Q)$-th line, output `Yes` if the $j$-th group is feasible; otherwise output `No`.

Explanation/Hint

**Explanation of the samples** The first group consists of 2 students 3 and 4. If student 3 receives student 4's gift and student 4 receives student 3's gift, then since $A_{3} \geq B_{4}$ and $A_{4} \geq B_{3}$, neither student will be dissatisfied. Therefore, this group is feasible, so output `Yes` on the first line. The second group consists of 3 students 1, 2, and 3. Since $A_{1}