#include"cstdio" #include"cstring" #include"cmath" #include"algorithm" #include"iostream" using namespace std; typedef long long LL; int a[35]; int main() {int t; cin>>t; while(t--) {memset(a,0,sizeof(a)); long long n,m; cin>>m>>n; long long k=0; while(n) { a[k++]=n%3; n/=3; } for(int i=m-1;i>=0;i--) {if(a[i]==0) cout<<"R"; else if(a[i]==1) cout<<"G"; else cout<<"B";} printf("\n"); } }