Sequence

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

ZZX has a sequence of boxes numbered 1,2,,n1, 2, \ldots, n. Each box can contain at most one ball.

You are given the initial configuration of the balls. For 1in1 \le i \le n, if the ii-th box is empty, then a_i=0a\_i = 0, otherwise the ii-th box contains exactly one ball, the color of which is a_ia\_i, a positive integer. Balls of the same color cannot be distinguished.

ZZX will perform mm operations in order. During ii-th operation, he collects all the balls from boxes l_i,l_i+1,,r_i1,r_il\_i, l\_i + 1, \ldots, r\_i - 1, r\_i, and then arbitrarily puts them back into these boxes. Note that each box should always contain at most one ball.

ZZX wants to change the configuration of the balls from a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n to b_1,b_2,,b_nb\_1, b\_2, \ldots, b\_n using these operations. Please tell ZZX whether it is possible to achieve his goal.

입력

The first line contains an integer T60T \le 60. Then TT test cases follow. In each test case:

The first line of the test case contains two integers nn and mm (1n10001 \le n \le 1000, 0m10000 \le m \le 1000, sum of nn over all test cases does not exceed 20002000, sum of mm over all test cases does not exceed 20002000).

The second line contains a_1,a_2,,a_na\_1, a\_2, \ldots ,a\_n (0a_in0 \le a\_i \le n). The third line contains b_1,b_2,,b_nb\_1, b\_2, \ldots, b\_n (0b_in0 \le b\_i \le n). Each of the next mm lines contains two integers l_il\_i and r_ir\_i (1l_ir_in1 \le l\_i \le r\_i \le n).

출력

For each test case, print "Yes" or "No" on a separate line.