#include #include #include #include #include #include typedef long long ll; using namespace std; void solve(){ int t; ll m,n; scanf("%d",&t); while(t--){ char s[40]; cin>>m>>n; ll a; for(int i = m-1; i>=0; i--){ a = n % 3; n = n / 3; if(a == 0) s[i] = 'R'; else if(a == 1) s[i] = 'G'; else s[i] = 'B'; } for(int i = 0; i