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 = [] for i in range(m): if C[i][0] == C[i][1]: if T: if sorted(T) == T and len(T) == len(set(T)): return "Yes" else: return "No" T = [] continue T.append(C[i][1]) if T: if sorted(T) == T and len(T) == len(set(T)): return "Yes" else: return "Yes" return "No" for _ in range(int(input())): print(main())