#include #include using namespace std; typedef long long ll; int main() { int T, ans[60], sz, m; ll n; scanf("%d", &T); while (T--) { scanf("%d %I64d", &m, &n); sz=0; memset(ans, 0, sizeof(ans)); while (n) { ans[sz++]=n%3; n/=3; } for (int i=m-1;i>=0;--i) { if (ans[i]==0) printf("R"); else if (ans[i]==1) printf("G"); else printf("B"); } printf("\n"); } return 0; }