There are multiple test cases. The first line of the input contains an integer $T$, indicating the number of test cases. For each test case:
The first line contains three integers $n$, $m$ and $p$ $(1 \le n \le 10^5, n \le m \le 10^9, 1 \le p \le 10^5 )$, indicating the number of participating teams, the number of seats and the number of predictions.
The second line contains $n$ integers $s_1,s_2,...,s_n$ $(1 \le s_i \le m$, and $s_i \ne s_j$ for all $i \ne j )$, indicating the seat number of each team.
The following $p$ lines each contains two integers $a_i$ and $b_i$ $(1\le a_i \le n, 1\le b_i \le 10^9)$, indicating that the $a_i$-th team solves a problem at time $b_i$ according to BaoBao's predictions.
It is guaranteed that neither the sum of $n$ nor the sum of $p$ over all test cases will exceed $5 \times 10^5$.