Pasha has been very sick. His platelets went way down. Being a paranoid person, he consulted N doctors about the optimal range in which Platelet Count should lie. The i-th doctor suggested that the Platelet count should be between li and ri, inclusive, to be called normal.
Now, Pasha thinks that a Platelet count is Safe to have if at least Z Doctors recommend it. Pasha now asks Q Queries. In each query- he will give an integer P (the platelet count). Pasha wants to know if the entered Platelet count is safe to have or not.
The first line contains T-denoting the number of test cases.
The first line of each test case contains an integer N -(Number of Doctors).
The next N Lines each contains two integers li and ri.
The next Line contains two integers - Z(Number of doctors that should recommend that platelets count is safe; at least) and Q(Number of queries being asked)
The next Q lines each contains an integer P.
For each test case-Output -"Yes", if its safe to have, else "No".
The first query : 7 is in [1,10] , [5,10] , [7,12]- So recommended by 3 Doctors-YES
The second query: 5 is in [1,10] , [5,10] - recommended by 2 doctors- "No"
The third query: 10 is in [1,10] , [5,10] , [7,12] recommended by 3 doctors- "Yes"
The Fourth query: 16 is in [15,25] recommended by 1 doctors- "No"
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.