def main(): n, m = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = [(a, b) for a, b in zip(A, B)] C.sort() T = [] l = 1 for i in range(m): if C[i][0] == C[i][1]: if T: if sorted(T) == T and len(T) == len(set(T)) and l <= T[0] and T[-1] < C[i][1]: return "Yes" else: return "No" l = C[i][1]+1 T = [] continue T.append(C[i][1]) if T: if sorted(T) == T and len(T) == len(set(T)) and l <= T[0]: return "Yes" else: return "Yes" return "No" for _ in range(int(input())): print(main())