//#pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int maxn=100250; const int INF=999999999; //const float eps = 0.00000001; const int mod=1000000007; //const int mod=100000000; const int VM=1220; const int EM=1000010; //const int N=120; //const double PI=3.14159; const double PI=3.14159265359; const double eps=1e-6; typedef pair P; //int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}}; //int dir[4][2]={{0,1},{0,-1},{-1,0},{1,0}}; int dir[4][2]={{1,0},{0,-1},{-1,0},{0,1}}; /** */ int main(){ //freopen("input.txt","r",stdin); //freopen("out.txt","w",stdout); int t,m; long long n; cin>>t; char str[3]={'R','G','B'}; while(t--){ cin>>m>>n; if(n==1){ for(int i=1;i=1;i--){ res[i]=str[n%3]; n/=3; } for(int i=1;i<=m;i++) printf("%c",res[i]); printf("\n"); } return 0; }