t = int(input())
for _ in range(t):
n, m = map(int, input().split())
critics = []
maxR = 0
maxW = 0
for _ in range(m):
r, w = map(int, input().split())
maxR = max(maxR, r)
maxW = max(maxW, w)
if maxR + maxW > n:
print("IMPOSSIBLE")
else:
print("W" * maxW + "R" * (n-maxW))
#include <bits/stdc++.h>
#define ll long long
#define mmm 1000000007
#define mm 998244353ll
#define pb push_back
#define pk pop_back
#define mp make_pair
#define alt(x) x.begin(), x.end()
#define cy "YES"
#define cn "NO"
using namespace std;
ll N=1e7+1;
vector<ll> hp(100001);
/*void sieve(ll n)
{
vector<ll> c(n+1,1);
for(ll i=2;i<=n;i++)
{
if(c[i])
{
hp[i]=i;
for(ll j=2*i;j<=n;j+=i)
{
c[j]=0;
hp[j]=i;
}}}} */
bool isPrime(int n)
{
if(n==2)return true;
if(n<=1)return false;
if(n<=3)return true;
if(n%2==0 || n%3==0)return false;
for(int i=5;i*i<=n;i=i+6)
if(n%i==0 || n%(i+2)==0)return false;
return true;
}
unsigned long long power(unsigned long long x,
ll y, ll p)
{
unsigned long long res = 1;
x = x % p;
while (y > 0)
{
// If y is odd, multiply x with result
if (y & 1)
res = (res * x) % p;
// y must be even now
y = y >> 1; // y = y/2
x = (x * x) % p;
}
return res;
}
// Returns n^(-1) mod p
unsigned long long modInverse(unsigned long long n,
int p)
{
return power(n, p - 2, p);
}
vector<ll> fac;
void initfact(ll n)
{
fac.resize(n + 1);
fac[0] = 1;
for (ll i = 1; i <= n; i++)
fac[i] = (fac[i - 1] * i) % mmm;
}
unsigned long long nCrModPFermat(unsigned long long n,
int r, int p)
{
// If n<r, then nCr should return 0
if (n < r)
return 0;
// Base case
if (n == 0 && r == 0)
return 1;
if (n == 0)
return 0;
if (r == 0)
return 1;
// Fill factorial array so that we
// can find all factorial of r, n
// and n-r
return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
ll countSetBits(ll n)
{
ll count = 0;
while (n)
{
count += n & 1;
n >>= 1;
}
return count;
}
void banao_be(){
ll n,m;
cin>>n>>m;
vector<pair<ll,ll>>v(m);
for(ll i = 0;i<m;i++){
cin>>v[i].first>>v[i].second;
}
string ans = "";
ll r = INT_MIN , w = INT_MIN;
for(ll i = 0;i<m;i++){
r = max(v[i].first,r);
w = max(v[i].second,w);
}
if(r+w>n)cout<<"IMPOSSIBLE"<<endl;
else {
for(ll i = 1;i<=w;i++)ans.pb('W');
for(ll i = 1;i<=r;i++)ans.pb('R');
for(ll i = ans.size();i<n;i++){
ans.pb('W');
}
cout<<ans<<endl;
}
}
int32_t main ()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
// sieve(100001);
while (t--){
banao_be();
}
return 0;
}
1712A - Wonderful Permutation | 1712D - Empty Graph |
1712B - Woeful Permutation | 1712C - Sort Zero |
1028B - Unnatural Conditions | 735B - Urbanization |
746C - Tram | 1278B - A and B |
1353D - Constructing the Array | 1269C - Long Beautiful Integer |
1076A - Minimizing the String | 913C - Party Lemonade |
1313A - Fast Food Restaurant | 681A - A Good Contest |
1585F - Non-equal Neighbours | 747A - Display Size |
285A - Slightly Decreasing Permutations | 515C - Drazil and Factorial |
1151E - Number of Components | 1151F - Sonya and Informatics |
556A - Case of the Zeros and Ones | 867A - Between the Offices |
1569A - Balanced Substring | 260A - Adding Digits |
1698C - 3SUM Closure | 1029B - Creating the Contest |
1421A - XORwice | 1029A - Many Equal Substrings |
1675D - Vertical Paths | 1271C - Shawarma Tent |