Alice is stuck on an island. The island has N animals. The ith animal has strength A[i]. Fortunately, Alice has N swords. ith sword has sharpness S[i]. Alice can kill an animal with a sword if and only if its sharpness is strictly greater than the strength of the animal. After killing the animal, its sharpness becomes 0. Alice wants to know if he can kill all the animals and escape from the island. Help him to know the same.
Input
First line of the input contains the number of test cases T. It is followed by T tets cases. Each test case has 3 lines. First line contains the number of animals N. It is followed by a line containing N elements where ith element is the sharpness of Alice's ith sword. It is followed by N elements where ith element is the strength of the animal i.
Output
For each test case output "YES" if Alice can kill all the animals. Else print "NO".
Constraints
1 <= N <= 10^5
1 <= S[i], A[i] <= 100 where 0 <= i < N
Read the editorial here.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor