#include #include #include using namespace std; typedef long long LL; int m; LL n; int a[40]; int main(){ int T; cin>>T; while(T--){ cin>>m>>n; memset(a, 0, sizeof(a)); /*LL temp = n%3; LL temp2 = n/3; //if(temp == (LL)2)temp2++; temp2 %= 3; a[m-1] = temp; a[m-2] = temp2;*/ for(int i = m-1; i >= 0; i--){ a[i] = n%3; int flag = 0; //if(n%3 == 2)flag = 1; n /= 3; //n += flag; } for(int i = 0; i < m; i++){ if(a[i] == 0)printf("R"); else if(a[i] == 1)printf("G"); else if(a[i] == 2)printf("B"); } //printf("%d\n", a[0]); printf("\n"); } return 0; }