Bottle Arrangements

아직 제출이 없습니다시간 제한2초메모리 제한2048 MB

문제

Gabriella has been instructed to organize a renowned wine tasting event which will be attended by mm critics. On display, there will be nn different varieties of wine, each of which can either be a red wine or a white wine.

The wines will come in nn bottles arranged in a line on the table, and, for convenience, each critic will sip from a contiguous interval of bottles: that is, he/she will taste exactly the bottles at position aa, a+1a + 1, \dots, bb for some 1abn1 ≤ a ≤ b ≤ n. The interval depends on the critic, who will select it on the spot according to their preferences. In fact, the ii-th critic (1im1 ≤ i ≤ m) has requested that he/she wants to taste exactly r_ir\_i red wines and w_iw\_i white wines.

Gabriella has yet to choose how many bottles of red wine and white wine there will be, and in what order they will appear. Help her find an arrangement (that is, a sequence of nn bottles of either red or white wine) that satisfies the requests of all the critics, or state that no such arrangement exists.

입력

Each test contains multiple test cases. The first line contains an integer tt (1t1001 ≤ t ≤ 100) — the number of test cases. The descriptions of the tt test cases follow.

The first line of each test case contains two integers nn and mm (1n1001 ≤ n ≤ 100, 1m1001 ≤ m ≤ 100) — the number of bottles of wine and the number of critics.

Each of the next mm lines contains two integers r_ir\_i and w_iw\_i (0r_i,w_i1000 ≤ r\_i , w\_i ≤ 100, r_i+w_i1r\_i + w\_i ≥ 1) — the number of red and white wines that the ii-th critic wants to taste.

출력

For each test case, if at least one solution exists, print a string of length nn made up of the characters R and W, where the jj-th character (1jn1 ≤ j ≤ n) denotes the type of the wine in the jj-th bottle of the arrangement (R for red and W for white).

If there are multiple solutions, print any. If no solution exists, print the string IMPOSSIBLE.