Prom Night
62% Success32800 Attempts20 Points1s Time Limit256MB Memory1024 KB Max Code

The Hexagon University of India will be hosting its Prom Night tonight.There would be M boys and N girls at the prom tonight. Each boy wants a girl who is strictly shorter than him. A girl can dance with only one boy and vice-versa. Given the heights of all the boys and girls tell whether it is possible for all boys to get a girl.

Input:
The first line contains T denoting the number of test cases.
Each test case contains three lines.
The first line contains M and N.
The second line contains M integers each denoting the height of boy.
The third contains N integers each denoting the height of girl.

Output:
Print YES if it is possible for each boy to get a girl else print NO.

Constraints:
1<=T<=10
1<=N, M<=10000
1<=Height<=200

Examples
Input
1
4 5
2 5 6 8
3 8 5 1 7
Output
YES

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

Loading Editor...
Results