L. Hidden Sequence
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

Your friend invented a game about guessing a hidden sequence.

There is a sequence $$$a_1,a_2,\dots,a_n$$$ of nonnegative integers that you do not know.

Instead, your friend gives $$$m$$$ clues about the sequence.

The clues have the format $$$l$$$ $$$r$$$ U or $$$l$$$ $$$r$$$ N (where $$$1 \leq l \leq r \leq n$$$), indicating if there is a unique maximum in the sequence $$$a_l,a_{l+1},\dots,a_r$$$ or not, respectively.

More formally, there is a unique maximum in the sequence $$$a_l,a_{l+1},\dots,a_r$$$ if there exists an integer $$$s$$$ such that $$$s \in [l,r]$$$ and $$$a_s \gt a_i$$$ for every $$$i \in [l,r] \setminus \{s\}$$$.

Can you find any sequence that satisfies the requirements, or tell that it is impossible to find such a sequence?

Input

The first line of the input contains an integer $$$t$$$ $$$(1 \leq t \leq 300)$$$, denoting the number of testcases.

For each testcase, the first line contains two integers $$$n$$$ $$$(1 \leq n \leq 300)$$$ and $$$m$$$ $$$(1 \leq m \leq \frac{n(n+1)}{2})$$$ denoting the number of elements in the hidden array and the number of hints, respectively. Then exactly $$$m$$$ lines follow, the $$$i$$$-th of which contains two integers $$$l_i$$$ and $$$r_i$$$ $$$(1 \leq l_i \leq r_i \leq n)$$$ and a character $$$c_i$$$, which can only be "U" or "N".

It is guaranteed that there are no two integers $$$1 \leq i \lt j \leq m$$$ such that $$$l_i=l_j$$$ and $$$r_i=r_j$$$.

It is guaranteed that the sum of $$$n$$$ across all testcases does not exceed $$$300$$$.

Output

For each testcase, you should output one line containing either "YES" if there is an array or "NO" if the hints are contradictory.

If the answer is "YES", additionally you should output $$$n$$$ integers corresponding to an array that satisfies the constraints. Each of these integers must be in the range $$$[1,10^9]$$$

Examples
Input
2
5 4
1 2 U
3 4 U
3 5 N
4 5 N
5 4
1 2 U
3 4 U
3 5 N
4 5 U
Output
YES
10 9 7 8 8 
YES
10 9 8 7 8 
Input
4
5 4
2 3 U
1 3 N
2 4 N
1 4 U
4 5
1 2 U
1 3 U
1 4 N
2 3 N
3 4 U
4 5
1 2 N
1 3 U
1 4 N
2 3 U
2 4 N
6 8
1 3 U
1 5 U
2 3 N
2 4 U
2 6 N
3 4 U
3 5 U
4 5 U
Output
NO
YES
8 7 7 8 
YES
7 7 8 8 
YES
12 10 10 11 10 11