#include <bits/stdc++.h>
#define endl "\n"
#define INT long long int

using namespace std;

char infile[100], outfile[100];
INT a[1001000];
int main() {
    ios::sync_with_stdio(false);
    INT T, n, t, i, I,c,d,m,k;
    cin >> T;
    for(I=1;I<=T;I++){
        sprintf(infile, ".%d.in", I);
        freopen(infile, "w", stdout);
        scanf("%lld",&n);
        printf("%lld\n",n);
        for(i=1;i<=n;i++){
			scanf("%lld",&a[i]);
            printf("%lld ", a[i]);
        }
        sprintf(outfile, ".%d.out", I);
        freopen(outfile, "w", stdout);
        INT sum = accumulate(a, a + n + 1, 0ll);
		INT mx = *max_element(a + 1, a + n + 1);
		if(mx * 2 > sum){
			puts("G");
		}
		else{
			if(sum % 2) puts("G");
			else puts("S");
		}
    }
}
