#include #include #include using namespace std; const char A[3] = {'R', 'G', 'B'}; int main() { int t, m, size; int buf[35]; unsigned long long n; scanf("%d", &t); while(t--) { scanf("%d %I64u", &m, &n); memset(buf, 0, sizeof(buf)); size = 0; while(n) { buf[size++] = n % 3; n /= 3; } for(int i = m - 1; i >= 0; i--) printf("%c", A[buf[i]]); printf("\n"); } return 0; }