/*Sherlock and Watson and Adler*/ #pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define exp 1e-10 #define ll long long using namespace std; const int N = 30 + 10; const int M = 10000 + 10; const int inf = 100000000; const int mod = 2009; char s[N]; int main() { int t,m,k,p,i; __int64 n; scanf("%d",&t); while(t--) { scanf("%d%I64d",&m,&n); p=m; for(i=1;i<=m;++i) s[i]='R'; while(n) { k=n%3; if(k==0) s[p]='R'; else if(k==1) s[p]='G'; else if(k==2) s[p]='B'; p--; n/=3; } for(i=1;i<=m;i++) printf("%c",s[i]); puts(""); } return 0; }