Problem: Sofia had an array of integers . One day she got bored with it, so she decided to sequentially apply modification operations to it.
Each modification operation is described by a pair of numbers and means that the element of the array with index should be assigned the value , i.e., perform the assignment . After applying all modification operations sequentially, Sofia discarded the resulting array.
Recently, you found an array of integers . You are interested in whether this array is Sofia's array. You know the values of the original array, as well as the values . The values turned out to be lost.
Is there a sequence such that the sequential application of modification operations to the array transforms it into the array ?
Input Format: The first line contains an integer () — the number of test cases.
Then follow the descriptions of the test cases.
The first line of each test case contains an integer () — the size of the array.
The second line of each test case contains integers () — the elements of the original array.
The third line of each test case contains integers () — the elements of the found array.
The fourth line contains an integer () — the number of modification operations.
The fifth line contains integers () — the preserved value for each modification operation.
It is guaranteed that the sum of the values of for all test cases does not exceed , similarly the sum of the values of for all test cases does not exceed .
Output Format: Output lines, each of which is the answer to the corresponding test case. As an answer, output "YES" if there exists a suitable sequence , and "NO" otherwise.
You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).