#P7814. Alice and Bob

Alice and Bob

Alice and Bob

Problem Description

Alice and Bob decide to play a game. Denote set S={ii[1,n]}S=\{i | i \in [1,n]\}. Starting with Alice, take a number from SS in turn and put it at the end of a sequence AA with deleting it from SS. Initially the sequence AA is empty. P(A)P(A) indicates that AA contains an increasing subsequence of length kk at this time. There are two versions of the game: \qquadVersion 11: Whoever makes the condition P(A)P(A) satisfied for the first time wins. \qquadVersion 22: Whoever makes the condition P(A)P(A) satisfied for the first time loses. For the above two versions: whoever can't take out a number fails, i.e., SS is empty when it is his turn. In fact, they have already taken qq numbers totally from the set SS and none of them have won . Now please tell Alice if she can win. If she can, tell her how many ways she can take in the next step. You can assume that Alice and Bob are smart enough since the q+1q+1-th operation.

Input

The first line of the input contains a single integer TT (1T10001\le T\le1000), the number of test cases. Each test case includes two lines: The first line contains 44 integers nn, vv, qq, kk ( 3n1053\le n\le10^{5} , 1v21\le v\le2, 2q<n2\le q< n, \textbf{qq is eveneven} , 2k1052\le k\le10^{5} ), denoting the size of SS, the version of the game, the number of the numbers already taken, the parameter denoting the length of increasing subsequence. The second line contains qq integers denoting numbers taken out alreadly in order by steps. It is guaranteed that n,q[1,106]\sum n, \sum q \in [1,10^{6}].

Output

For each test case: If Alice can't win, print a single line containing "NONO". Otherwise, print a single line containing "YESYES" and an integer which denotes the number of different operations Alice can take in the next step to win with only one space seperated.

Sample Input

2
3 1 2 3
3 2
4 2 2 3
4 3

Sample Output

YES 1
NO

Source

2020 Multi-University Training Contest 5