#include <bits/stdc++.h>
using namespace std;
ifstream fin(“donjon.in”);
ofstream fout(“donjon.out”);
#define cin fin
#define cout fout
int main()
{
int t;
cin >> t;
while (t—)
{
int64_t n, k;
cin >> n >> k;
int64_t ans = (2 * n – k * k + k) / (2 * k);
if ((2 * n – k * k + k) % (2 * k) == 0 && ans > 0)
{
int xr = 0;
int x;
for (x = ans; x < ans + k && x % 4; ++x)
xr ^= x;
for (int y = ans + k – 1; y >= x && (y + 1) % 4; —y)
xr ^= y;
cout << (xr ? ‘G’:‘C’) << ‘ ‘ << ans << ‘\n’;
}
else
cout << “C\n”;
}
}