#include <bits/stdc++.h>
#define endl "\n"
#define INT long long int

using namespace std;

char infile[100], outfile[100];
char S[300000];
INT n, l, r, x, y;
int main() {
    ios::sync_with_stdio(false);
    INT T, n, i,j,A, a,I,o,e;
    cin >> T;
    for(I=1;I<=T;I++){
        sprintf(infile, ".%d.in", I);
        freopen(infile, "w", stdout);
        
        scanf("%d",&n);
        for(i=0;i<n;i++){
        	a = rand()%2;
        	S[i]=a+'0';
		}
        printf("%s", S);    
		    
	    o=e=0;
        for(i=0;i<n;i++){
            if(S[i]=='1')o++;
            else e++;
        }
        a = min(o,e);
        		
        sprintf(outfile, ".%d.out", I);
        freopen(outfile, "w", stdout);
        if( a%2 ) printf("G");
    	else printf("S");
    }
}
