Perfectly Balanced, As All Things Should Be [Senior]

Thank you all for participating in our joint-school mini competitions! The problem setters have decided to create a string that consists of $3n$ characters: D-s, L-s, and W-s (representing our three participating schools, DBS, LSC, and WYK respectively) to celebrate the end of their tedious and daunting problem setting process.

However, someone might be unimpressed by the string that the problem setters have created. They want to ruin their celebration! Although the string still consists of $3n$ D, L, and W-s, the individual frequencies of each character might no longer be $n$.

The problem setters want to make the string back into $n$ D, L, and W-s each using exactly $k$ operations. In one operation, they may pick any contiguous substring, regardless of length, and change all characters within the picked substring to either all D-s, all L-s, or all W-s.

Find a sequence of exactly $k$ operations so that the resulting string contains $n$ D-s, $n$ L-s, and $n$ W-s, or report that it is impossible to do so.

Input

The first line of the input contains two non-negative integers $n$ and $k$, denoting the desired frequency of each individual character in the resulting string, and the number of operations to be performed respectively.

The second line of the input contains a string of $3n$ characters, each of which is either D, L, or W.

Output

If a sequence of $k$ operations exists, output YES on the first line.

Then, output two positive integers $l$, $r$, and a character $c$ in each of the next $k$ lines. This denotes that you have picked the substring consisting of the $l$-th to $r$-th characters, and change them all to $c$.

Note that $1 \le l \le r \le 3n$ must be satisfied, and $c$ must be either D, L, or W for each of the $k$ operations.

Output the $k$ lines in the order that you perform the operations. If there are multiple such valid sequences, output any of them.

Otherwise, if no such sequence of $k$ operations exists, output NO on the first and only line.

Constraints

For all test cases, $1 \le n \le 10^5$, $0 \le k \le 3$, the string contains D, L, and W only.

Subtask 1 (9 points): $k=0$.

Subtask 2 (7 points): $k=3$.

Subtask 3 (10 points): $n \le 100$, $k=1$.

Subtask 4 (13 points): $n \le 1000$, $k=1$.

Subtask 5 (12 points): $k=1$, there are no D-s in the input string.

Subtask 6 (12 points): $k=1$.

Subtask 7 (16 points): $k=2$, the first $n$ characters in the input string are the same.

Subtask 8 (21 points): $k=2$.

Please note that there is not a subtask with "no additional constraints".

Sample Test Cases

Input Output
3 0
DLDLWWLWD
YES
2 1
LLLWLW
YES
2 3 D
3 2
DWDDDWLLW
YES
5 9 L
8 9 W
Click to copy.

Scoring: Per Subtask
Authored by jkjkjk
Appeared in Joint-School Pre-HKOI Mini Competition 2