#include #include #include #include #include #include #include #include #include #include #include #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1 #define ll long long #define ull unsigned long long using namespace std; const int inf = 0x3f3f3f3f; const int M = 10002; int a[40]; int main(){ // freopen("input.txt", "r", stdin); int t; scanf("%d", &t); while(t--){ long long m, n; scanf("%lld%lld", &m, &n); for(int i = m; i >= 1; i--){ a[i] = n%3; n = n/3; } for(int i = 1; i <= m; i++){ if(a[i] == 0){ printf("R"); } else if(a[i] == 1) printf("G"); else if(a[i] == 2) printf("B"); } printf("\n"); } return 0; }