Codeforces Round 770 (Div. 2)
E
Fair Share
Codeforces
2400
原题
← DF →
翻译中…

Even a cat has things it can do that AI cannot.— Fei-Fei Li

翻译中…

You are given $m$ arrays of positive integers. Each array is of even length.

翻译中…

You need to split all these integers into two equal multisets $L$ and $R$, that is, each element of each array should go into one of two multisets (but not both). Additionally, for each of the $m$ arrays, exactly half of its elements should go into $L$, and the rest should go into $R$.

翻译中…

Give an example of such a division or determine that no such division exists.

翻译中…

Input

翻译中…

The first line contains an integer $m$ ($1 \le m \le 10 ^ 5$) — the number of arrays.

翻译中…

The next $2 \cdot m$ lines contain descriptions of the arrays.

翻译中…

For each array, the first line contains an even integer $n$ ($2 \le n \le 2 \cdot 10 ^ 5$) — the length of the array. The second line consists of $n$ space-separated integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10 ^ 9$) — array elements.

翻译中…

It is guaranteed that the sum of $n$ over all arrays does not exceed $2 \cdot 10^5$.

翻译中…

Output

翻译中…

If the answer exists, print "YES", and then print $m$ lines.

翻译中…

On each line, for each element, print the letter "L" or "R" (capitalized, without spaces), depending on which multiset the element should go into.

翻译中…

If there is no answer, print "NO" on the only line.

翻译中…

Note

翻译中…

In the first array, we add the first element to $R$ and the second to $L$. Now $L = \{2\}$, and $R = \{1\}$.

翻译中…

In the second array, we add the first and third elements to $L$ and the rest to $R$. Now $L = \{1, 2, 3\}$ and $R = \{1, 2, 3\}$.

翻译中…

In the third array, we add elements 2, 3, and 6 to $L$, and others — to $R$. As a result, $L = R = \{1, 1, 2, 2, 3, 3\}$.

翻译中…

样例

Input #1
3
2
1 2
4
1 2 3 3
6
1 1 2 2 3 3
Output #1
YES
RL
LRLR
RLLRRL
InputCopy OutputCopy
题目信息
题号
1634E
时间限制
1.5 s
内存限制
256 MB
标签
构造
数据结构
DFS 及类似
图匹配
图论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。