#include<bits/stdc++.h>
using namespace std;
int a[1000010];
char c[1000010];
int qc[1000010],qd[1000010],topc,botc,topd,botd;
int main()
{
int t;
cin>>t;
for(int i=1;i<=t;i++)
{
botc=1;botd=1;topc=0;topd=0;
int n;
cin>>n;
for(int j=1;j<=2*n;j++)
cin>>a[j];
c[1]='L';c[2*n]='L';
int k;
for(k=2;k<=2*n;k++)
if(a[k]==a[1]) break;
for(int j=k-1;j>=2;j--)
qc[++topc]=a[j];
for(int j=k+1;j<=2*n;j++)
qd[++topd]=a[j];
int j,flag;
for(j=2;j<=n;j++)
{
flag=0;
if(topc>=botc)
{
if(qc[topc]==qc[botc])
{
topc--;botc++;
c[j]='L';c[2*n+1-j]='L';
flag=1;cout<<c[j];continue;
}
if(qc[topc]==qd[botd])
{
topc--;botd++;
c[j]='L';c[2*n+1-j]='R';
flag=1;cout<<c[j];continue;
}
}
if(topd>=botd)
{
if(qc[topd]==qc[botc])
{
topd--;botc++;
c[j]='R';c[2*n+1-j]='L';
flag=1;cout<<c[j];continue;
}
if(qc[topd]==qd[botd])
{
topd--;botd++;
c[j]='R';c[2*n+1-j]='R';
flag=1;cout<<c[j];continue;
}
}
if(flag==0)
{
cout<<-1<<endl;break;
}
}
if(j==n+1)
{
for(int m=1;m<=2*n;m++)
cout<<c[m];
cout<<endl;
}
}
return 0;
}