Rt,B没过,求hack/ll
#include<bits/stdc++.h>
using namespace std;
#define inf 0x7fffffff
#define timeused() (double)clock()/CLOCKS_PER_SEC
#define rep(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define repp(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define debug() assert(0)
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x){
T f=1;x=0;char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
x*=f;
return x;
}
ll t,n,tot,pd;
string s1,s2;
vector<ll> v[100005];
int main(){
rd(t);
while(t--){
rd(n);
rep(i,1,n+1) v[i].clear();
tot=pd=1;
cin>>s1>>s2;
rep(i,0,n-1){
if(s1[i]^s2[i]) tot++;
else v[tot].push_back(s1[i]-'0');
}
rep(i,1,tot){
ll lst=1;
if(v[i].size()==1){
if(v[i][0]==1){
pd=0;
break;
}
}
while(v[i].size()>=2){
ll top1=*(v[i].end()-1);
v[i].pop_back();
ll top2=*(v[i].end()-1);
v[i].pop_back();
if(top1==1&&top2==1){
pd=0;
break;
}
if(top1==0&&top2==0) v[i].push_back(0);
}
if(v[i].size()){
if(*v[i].begin()==1){
pd=0;
break;
}
}
if(!pd) break;
}
pd?puts("RP"):puts("++");
}
}