#include <bits/stdc++.h>
using namespace std;
#define N 1000005
#define int long long
int n,m;
char ans[N];
int x[N];
void init(){
fill(ans,ans + N,'L');
}
bool work(deque<int> a,deque<int> b){
int step = 1;
while(step <= n){
if (a.size() > 1 && a.front() == a.back()){
a.pop_front();
a.pop_back();
} else if (a.size() && b.size() && a.front() == b.front()){
a.pop_front();
ans[m - step + 1] = 'R';
b.pop_front();
} else if (a.size() && b.size() && a.back() == b.back()){
a.pop_back();
ans[step] = 'R';
b.pop_back();
} else if (b.size() > 1 && b.front() == b.back()){
ans[step] = ans[m - step + 1] = 'R';
b.pop_front();
b.pop_back();
} else return false;
step++;
}
for (int i = 1;i <= m;i++) cout << ans[i];
cout << endl;
return true;
}
void solve(){
init();
deque<int> a,b,c,d;
cin >> n;
m = 2 * n;
for (int i = 1;i <= m;i++){
cin >> x[i];
if (i < 3) a.push_back(x[i]);
}
for (int i = 3;i <= m;i++){
if (a.front() != a.back()) a.push_back(x[i]);
else b.push_back(x[i]);
}
d.push_front(x[m]);
d.push_front(x[m - 1]);
for (int i = m - 2;i > 0;i--){
if (d.front() != d.back()) d.push_front(x[i]);
else c.push_front(x[i]);
}
c.push_back(d.front());
d.pop_front();
if (!work(a,b) && !work(c,d)) cout << -1 << endl;
}
signed main(){
int t;
cin >> t;
while(t--) solve();
return 0;
}