There are a lot of sequences, and each sequence can represent a binary search, please judge whether two sequences can form the same binary search tree.

The first value is the root of the tree, and then you can add the value into the tree following the rules of binary search tree.

The first line will be an integer T, which is the number of test cases. (1 <= T <= 100). For each test case, the first line will be two integers n(1 <= n <= 100) and m(1 <= m <= 63), n is the number of judgement, m is the length of the sequences. The second line will be m integer, a_{1}……a_{m}(1 <= a_{i} <= 10^{9}), it is the standard sequences. Then followed by n lines, each line will be another arrangement of the standard sequences.

For each judgement, print YES when a arrangement of the standard sequences can form the same binary search tree with the standard sequences, else print NO.